aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/job-queue/job-queue.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-01-21 16:57:21 +0100
committerChocobozzz <chocobozzz@cpy.re>2021-01-25 14:38:52 +0100
commit77d7e851dccf17dcc89e8fcc2db3f655d1e63f95 (patch)
treed09e045dfabe7ab1e170d1b0caa9decda8a7d39c /server/lib/job-queue/job-queue.ts
parent92c871b40554d5285232eb4392cebb63d127704a (diff)
downloadPeerTube-77d7e851dccf17dcc89e8fcc2db3f655d1e63f95.tar.gz
PeerTube-77d7e851dccf17dcc89e8fcc2db3f655d1e63f95.tar.zst
PeerTube-77d7e851dccf17dcc89e8fcc2db3f655d1e63f95.zip
Add priority to transcoding jobs
(1 = highest priority) 100 for new resolutions 10 for original file optimization Add a malus for transcoding jobs depending on how many uploads the user did in the last 7 days
Diffstat (limited to 'server/lib/job-queue/job-queue.ts')
-rw-r--r--server/lib/job-queue/job-queue.ts2
1 files changed, 2 insertions, 0 deletions
diff --git a/server/lib/job-queue/job-queue.ts b/server/lib/job-queue/job-queue.ts
index 5d0b797b0..38b1d6f1f 100644
--- a/server/lib/job-queue/job-queue.ts
+++ b/server/lib/job-queue/job-queue.ts
@@ -47,6 +47,7 @@ type CreateJobArgument =
47 47
48type CreateJobOptions = { 48type CreateJobOptions = {
49 delay?: number 49 delay?: number
50 priority?: number
50} 51}
51 52
52const handlers: { [id in JobType]: (job: Bull.Job) => Promise<any> } = { 53const handlers: { [id in JobType]: (job: Bull.Job) => Promise<any> } = {
@@ -148,6 +149,7 @@ class JobQueue {
148 backoff: { delay: 60 * 1000, type: 'exponential' }, 149 backoff: { delay: 60 * 1000, type: 'exponential' },
149 attempts: JOB_ATTEMPTS[obj.type], 150 attempts: JOB_ATTEMPTS[obj.type],
150 timeout: JOB_TTL[obj.type], 151 timeout: JOB_TTL[obj.type],
152 priority: options.priority,
151 delay: options.delay 153 delay: options.delay
152 } 154 }
153 155