diff options
author | Chocobozzz <me@florianbigard.com> | 2022-08-08 15:48:17 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2022-08-09 09:18:07 +0200 |
commit | bd911b54b555b11df7e9849cf92d358bccfecf6e (patch) | |
tree | 23e94b4acbe6819fedc1cb5e067b700cbdd880c3 /server/lib/video-state.ts | |
parent | 5a921e7b74910414626bfc9672b857e987e3ebed (diff) | |
download | PeerTube-bd911b54b555b11df7e9849cf92d358bccfecf6e.tar.gz PeerTube-bd911b54b555b11df7e9849cf92d358bccfecf6e.tar.zst PeerTube-bd911b54b555b11df7e9849cf92d358bccfecf6e.zip |
Use bullmq job dependency
Diffstat (limited to 'server/lib/video-state.ts')
-rw-r--r-- | server/lib/video-state.ts | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/server/lib/video-state.ts b/server/lib/video-state.ts index b5d8353b7..9ebbd7679 100644 --- a/server/lib/video-state.ts +++ b/server/lib/video-state.ts | |||
@@ -1,4 +1,5 @@ | |||
1 | import { Transaction } from 'sequelize' | 1 | import { Transaction } from 'sequelize' |
2 | import { retryTransactionWrapper } from '@server/helpers/database-utils' | ||
2 | import { logger } from '@server/helpers/logger' | 3 | import { logger } from '@server/helpers/logger' |
3 | import { CONFIG } from '@server/initializers/config' | 4 | import { CONFIG } from '@server/initializers/config' |
4 | import { sequelizeTypescript } from '@server/initializers/database' | 5 | import { sequelizeTypescript } from '@server/initializers/database' |
@@ -7,9 +8,9 @@ import { VideoJobInfoModel } from '@server/models/video/video-job-info' | |||
7 | import { MVideo, MVideoFullLight, MVideoUUID } from '@server/types/models' | 8 | import { MVideo, MVideoFullLight, MVideoUUID } from '@server/types/models' |
8 | import { VideoState } from '@shared/models' | 9 | import { VideoState } from '@shared/models' |
9 | import { federateVideoIfNeeded } from './activitypub/videos' | 10 | import { federateVideoIfNeeded } from './activitypub/videos' |
11 | import { JobQueue } from './job-queue' | ||
10 | import { Notifier } from './notifier' | 12 | import { Notifier } from './notifier' |
11 | import { addMoveToObjectStorageJob } from './video' | 13 | import { buildMoveToObjectStorageJob } from './video' |
12 | import { retryTransactionWrapper } from '@server/helpers/database-utils' | ||
13 | 14 | ||
14 | function buildNextVideoState (currentState?: VideoState) { | 15 | function buildNextVideoState (currentState?: VideoState) { |
15 | if (currentState === VideoState.PUBLISHED) { | 16 | if (currentState === VideoState.PUBLISHED) { |
@@ -86,7 +87,7 @@ async function moveToExternalStorageState (options: { | |||
86 | logger.info('Creating external storage move job for video %s.', video.uuid, { tags: [ video.uuid ] }) | 87 | logger.info('Creating external storage move job for video %s.', video.uuid, { tags: [ video.uuid ] }) |
87 | 88 | ||
88 | try { | 89 | try { |
89 | await addMoveToObjectStorageJob({ video, previousVideoState, isNewVideo }) | 90 | await JobQueue.Instance.createJob(await buildMoveToObjectStorageJob({ video, previousVideoState, isNewVideo })) |
90 | 91 | ||
91 | return true | 92 | return true |
92 | } catch (err) { | 93 | } catch (err) { |