aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/runners/job-handlers
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2023-05-19 10:10:41 +0200
committerChocobozzz <me@florianbigard.com>2023-05-19 10:10:41 +0200
commit472170b4f923a52cceb595221864eab61d624d5b (patch)
treed466b9e7b4f0eb54bffb30250f66b604bf907768 /server/lib/runners/job-handlers
parent26172955691acd6d7b682647dda6b2109e426c51 (diff)
downloadPeerTube-472170b4f923a52cceb595221864eab61d624d5b.tar.gz
PeerTube-472170b4f923a52cceb595221864eab61d624d5b.tar.zst
PeerTube-472170b4f923a52cceb595221864eab61d624d5b.zip
Avoid aborting completing jobs
Diffstat (limited to 'server/lib/runners/job-handlers')
-rw-r--r--server/lib/runners/job-handlers/abstract-job-handler.ts13
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 @@
1import { throttle } from 'lodash' 1import { throttle } from 'lodash'
2import { retryTransactionWrapper } from '@server/helpers/database-utils' 2import { retryTransactionWrapper, saveInTransactionWithRetries } from '@server/helpers/database-utils'
3import { logger, loggerTagsFactory } from '@server/helpers/logger' 3import { logger, loggerTagsFactory } from '@server/helpers/logger'
4import { RUNNER_JOBS } from '@server/initializers/constants' 4import { RUNNER_JOBS } from '@server/initializers/constants'
5import { sequelizeTypescript } from '@server/initializers/database' 5import { 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