diff options
Diffstat (limited to 'server/lib/jobs')
4 files changed, 7 insertions, 5 deletions
diff --git a/server/lib/jobs/http-request-job-scheduler/http-request-broadcast-handler.ts b/server/lib/jobs/http-request-job-scheduler/http-request-broadcast-handler.ts index 2f1d9ee92..ccb008e4d 100644 --- a/server/lib/jobs/http-request-job-scheduler/http-request-broadcast-handler.ts +++ b/server/lib/jobs/http-request-job-scheduler/http-request-broadcast-handler.ts | |||
@@ -22,8 +22,9 @@ function onError (err: Error, jobId: number) { | |||
22 | return Promise.resolve() | 22 | return Promise.resolve() |
23 | } | 23 | } |
24 | 24 | ||
25 | async function onSuccess (jobId: number) { | 25 | function onSuccess (jobId: number) { |
26 | logger.info('Job %d is a success.', jobId) | 26 | logger.info('Job %d is a success.', jobId) |
27 | return Promise.resolve() | ||
27 | } | 28 | } |
28 | 29 | ||
29 | // --------------------------------------------------------------------------- | 30 | // --------------------------------------------------------------------------- |
diff --git a/server/lib/jobs/http-request-job-scheduler/http-request-unicast-handler.ts b/server/lib/jobs/http-request-job-scheduler/http-request-unicast-handler.ts index 3a1a7fabf..9e4e73891 100644 --- a/server/lib/jobs/http-request-job-scheduler/http-request-unicast-handler.ts +++ b/server/lib/jobs/http-request-job-scheduler/http-request-unicast-handler.ts | |||
@@ -20,8 +20,9 @@ function onError (err: Error, jobId: number) { | |||
20 | return Promise.resolve() | 20 | return Promise.resolve() |
21 | } | 21 | } |
22 | 22 | ||
23 | async function onSuccess (jobId: number) { | 23 | function onSuccess (jobId: number) { |
24 | logger.info('Job %d is a success.', jobId) | 24 | logger.info('Job %d is a success.', jobId) |
25 | return Promise.resolve() | ||
25 | } | 26 | } |
26 | 27 | ||
27 | // --------------------------------------------------------------------------- | 28 | // --------------------------------------------------------------------------- |
diff --git a/server/lib/jobs/job-scheduler.ts b/server/lib/jobs/job-scheduler.ts index b25bb7ab3..73c440279 100644 --- a/server/lib/jobs/job-scheduler.ts +++ b/server/lib/jobs/job-scheduler.ts | |||
@@ -9,7 +9,7 @@ import { error } from 'util' | |||
9 | export interface JobHandler<P, T> { | 9 | export interface JobHandler<P, T> { |
10 | process (data: object, jobId: number): Promise<T> | 10 | process (data: object, jobId: number): Promise<T> |
11 | onError (err: Error, jobId: number) | 11 | onError (err: Error, jobId: number) |
12 | onSuccess (jobId: number, jobResult: T, jobScheduler: JobScheduler<P, T>) | 12 | onSuccess (jobId: number, jobResult: T, jobScheduler: JobScheduler<P, T>): Promise<any> |
13 | } | 13 | } |
14 | type JobQueueCallback = (err: Error) => void | 14 | type JobQueueCallback = (err: Error) => void |
15 | 15 | ||
@@ -127,7 +127,7 @@ class JobScheduler<P, T> { | |||
127 | 127 | ||
128 | try { | 128 | try { |
129 | await job.save() | 129 | await job.save() |
130 | jobHandler.onSuccess(job.id, jobResult, this) | 130 | await jobHandler.onSuccess(job.id, jobResult, this) |
131 | } catch (err) { | 131 | } catch (err) { |
132 | this.cannotSaveJobError(err) | 132 | this.cannotSaveJobError(err) |
133 | } | 133 | } |
diff --git a/server/lib/jobs/transcoding-job-scheduler/video-file-optimizer-handler.ts b/server/lib/jobs/transcoding-job-scheduler/video-file-optimizer-handler.ts index d3ee886e7..f6d9627a5 100644 --- a/server/lib/jobs/transcoding-job-scheduler/video-file-optimizer-handler.ts +++ b/server/lib/jobs/transcoding-job-scheduler/video-file-optimizer-handler.ts | |||
@@ -39,8 +39,8 @@ async function onSuccess (jobId: number, video: VideoInstance, jobScheduler: Job | |||
39 | await sendAddVideo(video, undefined) | 39 | await sendAddVideo(video, undefined) |
40 | 40 | ||
41 | const originalFileHeight = await videoDatabase.getOriginalFileHeight() | 41 | const originalFileHeight = await videoDatabase.getOriginalFileHeight() |
42 | // Create transcoding jobs if there are enabled resolutions | ||
43 | 42 | ||
43 | // Create transcoding jobs if there are enabled resolutions | ||
44 | const resolutionsEnabled = computeResolutionsToTranscode(originalFileHeight) | 44 | const resolutionsEnabled = computeResolutionsToTranscode(originalFileHeight) |
45 | logger.info( | 45 | logger.info( |
46 | 'Resolutions computed for video %s and origin file height of %d.', videoDatabase.uuid, originalFileHeight, | 46 | 'Resolutions computed for video %s and origin file height of %d.', videoDatabase.uuid, originalFileHeight, |