diff options
Diffstat (limited to 'server')
-rw-r--r-- | server/lib/job-queue/handlers/video-import.ts | 3 | ||||
-rw-r--r-- | server/lib/job-queue/job-queue.ts | 5 | ||||
-rw-r--r-- | server/models/video/video-import.ts | 6 |
3 files changed, 10 insertions, 4 deletions
diff --git a/server/lib/job-queue/handlers/video-import.ts b/server/lib/job-queue/handlers/video-import.ts index 5a7722153..4f2faab7d 100644 --- a/server/lib/job-queue/handlers/video-import.ts +++ b/server/lib/job-queue/handlers/video-import.ts | |||
@@ -35,7 +35,7 @@ async function processVideoImport (job: Bull.Job) { | |||
35 | 35 | ||
36 | // Get information about this video | 36 | // Get information about this video |
37 | const { videoFileResolution } = await getVideoFileResolution(tempVideoPath) | 37 | const { videoFileResolution } = await getVideoFileResolution(tempVideoPath) |
38 | const fps = await getVideoFileFPS(tempVideoPath + 's') | 38 | const fps = await getVideoFileFPS(tempVideoPath) |
39 | const stats = await statPromise(tempVideoPath) | 39 | const stats = await statPromise(tempVideoPath) |
40 | const duration = await getDurationFromVideoFile(tempVideoPath) | 40 | const duration = await getDurationFromVideoFile(tempVideoPath) |
41 | 41 | ||
@@ -115,6 +115,7 @@ async function processVideoImport (job: Bull.Job) { | |||
115 | logger.error('Cannot cleanup files after a video import error.', { err: errUnlink }) | 115 | logger.error('Cannot cleanup files after a video import error.', { err: errUnlink }) |
116 | } | 116 | } |
117 | 117 | ||
118 | videoImport.error = err.message | ||
118 | videoImport.state = VideoImportState.FAILED | 119 | videoImport.state = VideoImportState.FAILED |
119 | await videoImport.save() | 120 | await videoImport.save() |
120 | 121 | ||
diff --git a/server/lib/job-queue/job-queue.ts b/server/lib/job-queue/job-queue.ts index 2e14867f2..ffd948b5f 100644 --- a/server/lib/job-queue/job-queue.ts +++ b/server/lib/job-queue/job-queue.ts | |||
@@ -79,7 +79,10 @@ class JobQueue { | |||
79 | const handler = handlers[handlerName] | 79 | const handler = handlers[handlerName] |
80 | 80 | ||
81 | queue.process(JOB_CONCURRENCY[handlerName], handler) | 81 | queue.process(JOB_CONCURRENCY[handlerName], handler) |
82 | .catch(err => logger.error('Cannot execute job queue %s.', handlerName, { err })) | 82 | |
83 | queue.on('failed', (job, err) => { | ||
84 | logger.error('Cannot execute job %d in queue %s.', job.id, handlerName, { payload: job.data, err }) | ||
85 | }) | ||
83 | 86 | ||
84 | queue.on('error', err => { | 87 | queue.on('error', err => { |
85 | logger.error('Error in job queue %s.', handlerName, { err }) | 88 | logger.error('Error in job queue %s.', handlerName, { err }) |
diff --git a/server/models/video/video-import.ts b/server/models/video/video-import.ts index 6b8a16b65..c2e55509c 100644 --- a/server/models/video/video-import.ts +++ b/server/models/video/video-import.ts | |||
@@ -26,7 +26,7 @@ import { TagModel } from './tag' | |||
26 | include: [ | 26 | include: [ |
27 | { | 27 | { |
28 | model: () => VideoModel, | 28 | model: () => VideoModel, |
29 | required: true, | 29 | required: false, |
30 | include: [ | 30 | include: [ |
31 | { | 31 | { |
32 | model: () => VideoChannelModel, | 32 | model: () => VideoChannelModel, |
@@ -112,7 +112,7 @@ export class VideoImportModel extends Model<VideoImportModel> { | |||
112 | include: [ | 112 | include: [ |
113 | { | 113 | { |
114 | model: VideoModel, | 114 | model: VideoModel, |
115 | required: true, | 115 | required: false, |
116 | include: [ | 116 | include: [ |
117 | { | 117 | { |
118 | model: VideoChannelModel, | 118 | model: VideoChannelModel, |
@@ -157,11 +157,13 @@ export class VideoImportModel extends Model<VideoImportModel> { | |||
157 | : undefined | 157 | : undefined |
158 | 158 | ||
159 | return { | 159 | return { |
160 | id: this.id, | ||
160 | targetUrl: this.targetUrl, | 161 | targetUrl: this.targetUrl, |
161 | state: { | 162 | state: { |
162 | id: this.state, | 163 | id: this.state, |
163 | label: VideoImportModel.getStateLabel(this.state) | 164 | label: VideoImportModel.getStateLabel(this.state) |
164 | }, | 165 | }, |
166 | error: this.error, | ||
165 | updatedAt: this.updatedAt.toISOString(), | 167 | updatedAt: this.updatedAt.toISOString(), |
166 | createdAt: this.createdAt.toISOString(), | 168 | createdAt: this.createdAt.toISOString(), |
167 | video | 169 | video |