diff options
author | Chocobozzz <me@florianbigard.com> | 2021-01-21 16:57:21 +0100 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2021-01-25 14:38:52 +0100 |
commit | 77d7e851dccf17dcc89e8fcc2db3f655d1e63f95 (patch) | |
tree | d09e045dfabe7ab1e170d1b0caa9decda8a7d39c /server/lib/job-queue/job-queue.ts | |
parent | 92c871b40554d5285232eb4392cebb63d127704a (diff) | |
download | PeerTube-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.ts | 2 |
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 | ||
48 | type CreateJobOptions = { | 48 | type CreateJobOptions = { |
49 | delay?: number | 49 | delay?: number |
50 | priority?: number | ||
50 | } | 51 | } |
51 | 52 | ||
52 | const handlers: { [id in JobType]: (job: Bull.Job) => Promise<any> } = { | 53 | const 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 | ||