diff options
author | Chocobozzz <me@florianbigard.com> | 2019-03-19 17:00:08 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2019-03-19 17:00:08 +0100 |
commit | a0327eedb0136c4ba7358df80b75cc56bd25ffb8 (patch) | |
tree | 7de1486d3671e85ce53c650f74f70dbf3d8845b2 /server/lib/job-queue/handlers | |
parent | 1ed9b8ee69ba42b2be70512eb8df239be4676674 (diff) | |
download | PeerTube-a0327eedb0136c4ba7358df80b75cc56bd25ffb8.tar.gz PeerTube-a0327eedb0136c4ba7358df80b75cc56bd25ffb8.tar.zst PeerTube-a0327eedb0136c4ba7358df80b75cc56bd25ffb8.zip |
Rename video-file job to video-transcoding
Diffstat (limited to 'server/lib/job-queue/handlers')
-rw-r--r-- | server/lib/job-queue/handlers/video-import.ts | 2 | ||||
-rw-r--r-- | server/lib/job-queue/handlers/video-transcoding.ts (renamed from server/lib/job-queue/handlers/video-file.ts) | 18 |
2 files changed, 10 insertions, 10 deletions
diff --git a/server/lib/job-queue/handlers/video-import.ts b/server/lib/job-queue/handlers/video-import.ts index 12004dcd7..d96bfdf43 100644 --- a/server/lib/job-queue/handlers/video-import.ts +++ b/server/lib/job-queue/handlers/video-import.ts | |||
@@ -207,7 +207,7 @@ async function processFile (downloader: () => Promise<string>, videoImport: Vide | |||
207 | isNewVideo: true | 207 | isNewVideo: true |
208 | } | 208 | } |
209 | 209 | ||
210 | await JobQueue.Instance.createJob({ type: 'video-file', payload: dataInput }) | 210 | await JobQueue.Instance.createJob({ type: 'video-transcoding', payload: dataInput }) |
211 | } | 211 | } |
212 | 212 | ||
213 | } catch (err) { | 213 | } catch (err) { |
diff --git a/server/lib/job-queue/handlers/video-file.ts b/server/lib/job-queue/handlers/video-transcoding.ts index 3a867b77f..ceee83f13 100644 --- a/server/lib/job-queue/handlers/video-file.ts +++ b/server/lib/job-queue/handlers/video-transcoding.ts | |||
@@ -11,7 +11,7 @@ import { computeResolutionsToTranscode } from '../../../helpers/ffmpeg-utils' | |||
11 | import { generateHlsPlaylist, importVideoFile, optimizeVideofile, transcodeOriginalVideofile } from '../../video-transcoding' | 11 | import { generateHlsPlaylist, importVideoFile, optimizeVideofile, transcodeOriginalVideofile } from '../../video-transcoding' |
12 | import { Notifier } from '../../notifier' | 12 | import { Notifier } from '../../notifier' |
13 | 13 | ||
14 | export type VideoFilePayload = { | 14 | export type VideoTranscodingPayload = { |
15 | videoUUID: string | 15 | videoUUID: string |
16 | resolution?: VideoResolution | 16 | resolution?: VideoResolution |
17 | isNewVideo?: boolean | 17 | isNewVideo?: boolean |
@@ -41,8 +41,8 @@ async function processVideoFileImport (job: Bull.Job) { | |||
41 | return video | 41 | return video |
42 | } | 42 | } |
43 | 43 | ||
44 | async function processVideoFile (job: Bull.Job) { | 44 | async function processVideoTranscoding (job: Bull.Job) { |
45 | const payload = job.data as VideoFilePayload | 45 | const payload = job.data as VideoTranscodingPayload |
46 | logger.info('Processing video file in job %d.', job.id) | 46 | logger.info('Processing video file in job %d.', job.id) |
47 | 47 | ||
48 | const video = await VideoModel.loadAndPopulateAccountAndServerAndTags(payload.videoUUID) | 48 | const video = await VideoModel.loadAndPopulateAccountAndServerAndTags(payload.videoUUID) |
@@ -83,7 +83,7 @@ async function onHlsPlaylistGenerationSuccess (video: VideoModel) { | |||
83 | }) | 83 | }) |
84 | } | 84 | } |
85 | 85 | ||
86 | async function onVideoFileTranscoderOrImportSuccess (video: VideoModel, payload?: VideoFilePayload) { | 86 | async function onVideoFileTranscoderOrImportSuccess (video: VideoModel, payload?: VideoTranscodingPayload) { |
87 | if (video === undefined) return undefined | 87 | if (video === undefined) return undefined |
88 | 88 | ||
89 | const { videoDatabase, videoPublished } = await sequelizeTypescript.transaction(async t => { | 89 | const { videoDatabase, videoPublished } = await sequelizeTypescript.transaction(async t => { |
@@ -118,7 +118,7 @@ async function onVideoFileTranscoderOrImportSuccess (video: VideoModel, payload? | |||
118 | await createHlsJobIfEnabled(payload) | 118 | await createHlsJobIfEnabled(payload) |
119 | } | 119 | } |
120 | 120 | ||
121 | async function onVideoFileOptimizerSuccess (videoArg: VideoModel, payload: VideoFilePayload) { | 121 | async function onVideoFileOptimizerSuccess (videoArg: VideoModel, payload: VideoTranscodingPayload) { |
122 | if (videoArg === undefined) return undefined | 122 | if (videoArg === undefined) return undefined |
123 | 123 | ||
124 | // Outside the transaction (IO on disk) | 124 | // Outside the transaction (IO on disk) |
@@ -148,7 +148,7 @@ async function onVideoFileOptimizerSuccess (videoArg: VideoModel, payload: Video | |||
148 | resolution | 148 | resolution |
149 | } | 149 | } |
150 | 150 | ||
151 | const p = JobQueue.Instance.createJob({ type: 'video-file', payload: dataInput }) | 151 | const p = JobQueue.Instance.createJob({ type: 'video-transcoding', payload: dataInput }) |
152 | tasks.push(p) | 152 | tasks.push(p) |
153 | } | 153 | } |
154 | 154 | ||
@@ -182,13 +182,13 @@ async function onVideoFileOptimizerSuccess (videoArg: VideoModel, payload: Video | |||
182 | // --------------------------------------------------------------------------- | 182 | // --------------------------------------------------------------------------- |
183 | 183 | ||
184 | export { | 184 | export { |
185 | processVideoFile, | 185 | processVideoTranscoding, |
186 | processVideoFileImport | 186 | processVideoFileImport |
187 | } | 187 | } |
188 | 188 | ||
189 | // --------------------------------------------------------------------------- | 189 | // --------------------------------------------------------------------------- |
190 | 190 | ||
191 | function createHlsJobIfEnabled (payload?: VideoFilePayload) { | 191 | function createHlsJobIfEnabled (payload?: VideoTranscodingPayload) { |
192 | // Generate HLS playlist? | 192 | // Generate HLS playlist? |
193 | if (payload && CONFIG.TRANSCODING.HLS.ENABLED) { | 193 | if (payload && CONFIG.TRANSCODING.HLS.ENABLED) { |
194 | const hlsTranscodingPayload = { | 194 | const hlsTranscodingPayload = { |
@@ -199,6 +199,6 @@ function createHlsJobIfEnabled (payload?: VideoFilePayload) { | |||
199 | generateHlsPlaylist: true | 199 | generateHlsPlaylist: true |
200 | } | 200 | } |
201 | 201 | ||
202 | return JobQueue.Instance.createJob({ type: 'video-file', payload: hlsTranscodingPayload }) | 202 | return JobQueue.Instance.createJob({ type: 'video-transcoding', payload: hlsTranscodingPayload }) |
203 | } | 203 | } |
204 | } | 204 | } |