From 5a921e7b74910414626bfc9672b857e987e3ebed Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 8 Aug 2022 10:42:08 +0200 Subject: Move to bullmq --- server/controllers/api/videos/update.ts | 4 ++-- server/controllers/api/videos/upload.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'server/controllers/api/videos') diff --git a/server/controllers/api/videos/update.ts b/server/controllers/api/videos/update.ts index 65a7321fd..1545a2232 100644 --- a/server/controllers/api/videos/update.ts +++ b/server/controllers/api/videos/update.ts @@ -199,7 +199,7 @@ async function updateTorrentsMetadataIfNeeded (video: MVideoFullLight, videoInfo const payload: ManageVideoTorrentPayload = { action: 'update-metadata', videoId: video.id, videoFileId: file.id } const job = await JobQueue.Instance.createJobWithPromise({ type: 'manage-video-torrent', payload }) - await job.finished() + await JobQueue.Instance.waitJob(job) } const hls = video.getHLSPlaylist() @@ -208,7 +208,7 @@ async function updateTorrentsMetadataIfNeeded (video: MVideoFullLight, videoInfo const payload: ManageVideoTorrentPayload = { action: 'update-metadata', streamingPlaylistId: hls.id, videoFileId: file.id } const job = await JobQueue.Instance.createJobWithPromise({ type: 'manage-video-torrent', payload }) - await job.finished() + await JobQueue.Instance.waitJob(job) } // Refresh video since files have changed diff --git a/server/controllers/api/videos/upload.ts b/server/controllers/api/videos/upload.ts index 3ce66c9ca..4a9d7b619 100644 --- a/server/controllers/api/videos/upload.ts +++ b/server/controllers/api/videos/upload.ts @@ -17,6 +17,7 @@ import { import { VideoPathManager } from '@server/lib/video-path-manager' import { buildNextVideoState } from '@server/lib/video-state' import { openapiOperationDoc } from '@server/middlewares/doc' +import { VideoSourceModel } from '@server/models/video/video-source' import { MVideoFile, MVideoFullLight } from '@server/types/models' import { getLowercaseExtension } from '@shared/core-utils' import { isAudioFile, uuidToShort } from '@shared/extra-utils' @@ -44,7 +45,6 @@ import { import { ScheduleVideoUpdateModel } from '../../../models/video/schedule-video-update' import { VideoModel } from '../../../models/video/video' import { VideoFileModel } from '../../../models/video/video-file' -import { VideoSourceModel } from '@server/models/video/video-source' const lTags = loggerTagsFactory('api', 'video') const auditLogger = auditLoggerFactory('videos') @@ -270,7 +270,7 @@ async function createTorrentFederate (video: MVideoFullLight, videoFile: MVideoF const payload: ManageVideoTorrentPayload = { videoId: video.id, videoFileId: videoFile.id, action: 'create' } const job = await JobQueue.Instance.createJobWithPromise({ type: 'manage-video-torrent', payload }) - await job.finished() + await JobQueue.Instance.waitJob(job) const refreshedVideo = await VideoModel.loadFull(video.id) if (!refreshedVideo) return -- cgit v1.2.3