]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/lib/job-queue/job-queue.ts
Increase max stalled count in job queue
[github/Chocobozzz/PeerTube.git] / server / lib / job-queue / job-queue.ts
index b018d0e8a6291a6278a947fc53b659071d899977..8ff0c169e092276543b2eaa5dfbaf6aa12906787 100644 (file)
@@ -64,7 +64,10 @@ class JobQueue {
     this.jobRedisPrefix = 'bull-' + CONFIG.WEBSERVER.HOST
     const queueOptions = {
       prefix: this.jobRedisPrefix,
-      redis: Redis.getRedisClient()
+      redis: Redis.getRedisClient(),
+      settings: {
+        maxStalledCount: 10 // transcoding could be long, so jobs can often be interrupted by restarts
+      }
     }
 
     for (const handlerName of Object.keys(handlers)) {
@@ -83,6 +86,13 @@ class JobQueue {
     }
   }
 
+  terminate () {
+    for (const queueName of Object.keys(this.queues)) {
+      const queue = this.queues[queueName]
+      queue.close()
+    }
+  }
+
   createJob (obj: CreateJobArgument) {
     const queue = this.queues[obj.type]
     if (queue === undefined) {