From c0b5a5eb4be94038ce4d44e03cd14e2f5a844868 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 19 May 2023 15:20:12 +0200 Subject: [PATCH] Use saveInTransactionWithRetries helper --- .../job-handlers/abstract-job-handler.ts | 26 ++++--------------- 1 file changed, 5 insertions(+), 21 deletions(-) diff --git a/server/lib/runners/job-handlers/abstract-job-handler.ts b/server/lib/runners/job-handlers/abstract-job-handler.ts index ca97d0881..329977de1 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 @@ import { throttle } from 'lodash' -import { retryTransactionWrapper, saveInTransactionWithRetries } from '@server/helpers/database-utils' +import { saveInTransactionWithRetries } from '@server/helpers/database-utils' import { logger, loggerTagsFactory } from '@server/helpers/logger' import { RUNNER_JOBS } from '@server/initializers/constants' import { sequelizeTypescript } from '@server/initializers/database' @@ -124,11 +124,7 @@ export abstract class AbstractJobHandler { - return sequelizeTypescript.transaction(async transaction => { - return runnerJob.save({ transaction }) - }) - }) + await saveInTransactionWithRetries(runnerJob) } // --------------------------------------------------------------------------- @@ -184,11 +180,7 @@ export abstract class AbstractJobHandler { - return sequelizeTypescript.transaction(async transaction => { - await runnerJob.save({ transaction }) - }) - }) + await saveInTransactionWithRetries(runnerJob) const children = await RunnerJobModel.listChildrenOf(runnerJob) for (const child of children) { @@ -219,11 +211,7 @@ export abstract class AbstractJobHandler { - return sequelizeTypescript.transaction(async transaction => { - await runnerJob.save({ transaction }) - }) - }) + await saveInTransactionWithRetries(runnerJob) } protected setAbortState (runnerJob: MRunnerJob) { @@ -260,11 +248,7 @@ export abstract class AbstractJobHandler { - return sequelizeTypescript.transaction(async transaction => { - await runnerJob.save({ transaction }) - }) - }) + await saveInTransactionWithRetries(runnerJob) if (runnerJob.state === errorState) { const children = await RunnerJobModel.listChildrenOf(runnerJob)