diff options
Diffstat (limited to 'server/lib')
-rw-r--r-- | server/lib/runners/job-handlers/abstract-job-handler.ts | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/server/lib/runners/job-handlers/abstract-job-handler.ts b/server/lib/runners/job-handlers/abstract-job-handler.ts index 28c3e1eda..ca97d0881 100644 --- a/server/lib/runners/job-handlers/abstract-job-handler.ts +++ b/server/lib/runners/job-handlers/abstract-job-handler.ts | |||
@@ -1,5 +1,5 @@ | |||
1 | import { throttle } from 'lodash' | 1 | import { throttle } from 'lodash' |
2 | import { retryTransactionWrapper } from '@server/helpers/database-utils' | 2 | import { retryTransactionWrapper, saveInTransactionWithRetries } from '@server/helpers/database-utils' |
3 | import { logger, loggerTagsFactory } from '@server/helpers/logger' | 3 | import { logger, loggerTagsFactory } from '@server/helpers/logger' |
4 | import { RUNNER_JOBS } from '@server/initializers/constants' | 4 | import { RUNNER_JOBS } from '@server/initializers/constants' |
5 | import { sequelizeTypescript } from '@server/initializers/database' | 5 | import { sequelizeTypescript } from '@server/initializers/database' |
@@ -12,10 +12,10 @@ import { | |||
12 | RunnerJobLiveRTMPHLSTranscodingPayload, | 12 | RunnerJobLiveRTMPHLSTranscodingPayload, |
13 | RunnerJobLiveRTMPHLSTranscodingPrivatePayload, | 13 | RunnerJobLiveRTMPHLSTranscodingPrivatePayload, |
14 | RunnerJobState, | 14 | RunnerJobState, |
15 | RunnerJobStudioTranscodingPayload, | ||
15 | RunnerJobSuccessPayload, | 16 | RunnerJobSuccessPayload, |
16 | RunnerJobType, | 17 | RunnerJobType, |
17 | RunnerJobUpdatePayload, | 18 | RunnerJobUpdatePayload, |
18 | RunnerJobStudioTranscodingPayload, | ||
19 | RunnerJobVideoStudioTranscodingPrivatePayload, | 19 | RunnerJobVideoStudioTranscodingPrivatePayload, |
20 | RunnerJobVODAudioMergeTranscodingPayload, | 20 | RunnerJobVODAudioMergeTranscodingPayload, |
21 | RunnerJobVODAudioMergeTranscodingPrivatePayload, | 21 | RunnerJobVODAudioMergeTranscodingPrivatePayload, |
@@ -139,6 +139,9 @@ export abstract class AbstractJobHandler <C, U extends RunnerJobUpdatePayload, S | |||
139 | }) { | 139 | }) { |
140 | const { runnerJob } = options | 140 | const { runnerJob } = options |
141 | 141 | ||
142 | runnerJob.state = RunnerJobState.COMPLETING | ||
143 | await saveInTransactionWithRetries(runnerJob) | ||
144 | |||
142 | try { | 145 | try { |
143 | await this.specificComplete(options) | 146 | await this.specificComplete(options) |
144 | 147 | ||
@@ -153,11 +156,7 @@ export abstract class AbstractJobHandler <C, U extends RunnerJobUpdatePayload, S | |||
153 | runnerJob.progress = null | 156 | runnerJob.progress = null |
154 | runnerJob.finishedAt = new Date() | 157 | runnerJob.finishedAt = new Date() |
155 | 158 | ||
156 | await retryTransactionWrapper(() => { | 159 | await saveInTransactionWithRetries(runnerJob) |
157 | return sequelizeTypescript.transaction(async transaction => { | ||
158 | await runnerJob.save({ transaction }) | ||
159 | }) | ||
160 | }) | ||
161 | 160 | ||
162 | const [ affectedCount ] = await RunnerJobModel.updateDependantJobsOf(runnerJob) | 161 | const [ affectedCount ] = await RunnerJobModel.updateDependantJobsOf(runnerJob) |
163 | 162 | ||