fix(plugin-workflow): fix transaction when delete execution after processed (#5870)

This commit is contained in:
Junyi 2024-12-12 13:41:08 +08:00 committed by GitHub
parent c98954f9cb
commit cd5b0dc4d8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -599,7 +599,7 @@ export default class PluginWorkflowServer extends Plugin {
await (job ? processor.resume(job) : processor.start()); await (job ? processor.resume(job) : processor.start());
logger.info(`execution (${execution.id}) finished with status: ${execution.status}`, { execution }); logger.info(`execution (${execution.id}) finished with status: ${execution.status}`, { execution });
if (execution.status && execution.workflow.options?.deleteExecutionOnStatus?.includes(execution.status)) { if (execution.status && execution.workflow.options?.deleteExecutionOnStatus?.includes(execution.status)) {
await execution.destroy(); await execution.destroy({ transaction: processor.mainTransaction });
} }
} catch (err) { } catch (err) {
logger.error(`execution (${execution.id}) error: ${err.message}`, err); logger.error(`execution (${execution.id}) error: ${err.message}`, err);