diff options
author | Chocobozzz <me@florianbigard.com> | 2022-08-09 09:09:31 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2022-08-09 09:32:17 +0200 |
commit | b42c2c7e89a64ed730d8140840fe74a13c31f2a4 (patch) | |
tree | 715e7ad31d03881e3f3530dba1fe3d172251249b /server/lib/video.ts | |
parent | bd911b54b555b11df7e9849cf92d358bccfecf6e (diff) | |
download | PeerTube-b42c2c7e89a64ed730d8140840fe74a13c31f2a4.tar.gz PeerTube-b42c2c7e89a64ed730d8140840fe74a13c31f2a4.tar.zst PeerTube-b42c2c7e89a64ed730d8140840fe74a13c31f2a4.zip |
Avoid concurrency issue on transcoding
Diffstat (limited to 'server/lib/video.ts')
-rw-r--r-- | server/lib/video.ts | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/server/lib/video.ts b/server/lib/video.ts index f7d7aa186..6c4f3ce7b 100644 --- a/server/lib/video.ts +++ b/server/lib/video.ts | |||
@@ -9,7 +9,7 @@ import { VideoJobInfoModel } from '@server/models/video/video-job-info' | |||
9 | import { FilteredModelAttributes } from '@server/types' | 9 | import { FilteredModelAttributes } from '@server/types' |
10 | import { MThumbnail, MUserId, MVideoFile, MVideoTag, MVideoThumbnail, MVideoUUID } from '@server/types/models' | 10 | import { MThumbnail, MUserId, MVideoFile, MVideoTag, MVideoThumbnail, MVideoUUID } from '@server/types/models' |
11 | import { ThumbnailType, VideoCreate, VideoPrivacy, VideoState, VideoTranscodingPayload } from '@shared/models' | 11 | import { ThumbnailType, VideoCreate, VideoPrivacy, VideoState, VideoTranscodingPayload } from '@shared/models' |
12 | import { CreateJobOptions, JobQueue } from './job-queue/job-queue' | 12 | import { CreateJobOptions } from './job-queue/job-queue' |
13 | import { updateVideoMiniatureFromExisting } from './thumbnail' | 13 | import { updateVideoMiniatureFromExisting } from './thumbnail' |
14 | 14 | ||
15 | function buildLocalVideoFromReq (videoInfo: VideoCreate, channelId: number): FilteredModelAttributes<VideoModel> { | 15 | function buildLocalVideoFromReq (videoInfo: VideoCreate, channelId: number): FilteredModelAttributes<VideoModel> { |
@@ -121,10 +121,10 @@ async function buildOptimizeOrMergeAudioJob (options: { | |||
121 | } | 121 | } |
122 | } | 122 | } |
123 | 123 | ||
124 | async function addTranscodingJob (payload: VideoTranscodingPayload, options: CreateJobOptions = {}) { | 124 | async function buildTranscodingJob (payload: VideoTranscodingPayload, options: CreateJobOptions = {}) { |
125 | await VideoJobInfoModel.increaseOrCreate(payload.videoUUID, 'pendingTranscode') | 125 | await VideoJobInfoModel.increaseOrCreate(payload.videoUUID, 'pendingTranscode') |
126 | 126 | ||
127 | return JobQueue.Instance.createJob({ type: 'video-transcoding', payload, ...options }) | 127 | return { type: 'video-transcoding' as 'video-transcoding', payload, ...options } |
128 | } | 128 | } |
129 | 129 | ||
130 | async function getTranscodingJobPriority (user: MUserId) { | 130 | async function getTranscodingJobPriority (user: MUserId) { |
@@ -182,7 +182,7 @@ export { | |||
182 | buildVideoThumbnailsFromReq, | 182 | buildVideoThumbnailsFromReq, |
183 | setVideoTags, | 183 | setVideoTags, |
184 | buildOptimizeOrMergeAudioJob, | 184 | buildOptimizeOrMergeAudioJob, |
185 | addTranscodingJob, | 185 | buildTranscodingJob, |
186 | buildMoveToObjectStorageJob, | 186 | buildMoveToObjectStorageJob, |
187 | getTranscodingJobPriority, | 187 | getTranscodingJobPriority, |
188 | getCachedVideoDuration | 188 | getCachedVideoDuration |