mirror of
https://github.com/nocobase/nocobase
synced 2024-11-15 14:16:26 +00:00
fix(plugin-workflow): fix transaction in trigger (#1186)
This commit is contained in:
parent
dd91aee89d
commit
eb4fb29e3b
@ -152,10 +152,7 @@ export default class WorkflowPlugin extends Plugin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// @ts-ignore
|
const transaction = await (<typeof WorkflowModel>workflow.constructor).database.sequelize.transaction();
|
||||||
const transaction = options.transaction && !options.transaction.finished
|
|
||||||
? options.transaction
|
|
||||||
: await (<typeof WorkflowModel>workflow.constructor).database.sequelize.transaction();
|
|
||||||
|
|
||||||
const execution = await workflow.createExecution({
|
const execution = await workflow.createExecution({
|
||||||
context,
|
context,
|
||||||
@ -189,10 +186,7 @@ export default class WorkflowPlugin extends Plugin {
|
|||||||
|
|
||||||
execution.workflow = workflow;
|
execution.workflow = workflow;
|
||||||
|
|
||||||
// @ts-ignore
|
await transaction.commit();
|
||||||
if (transaction && (!options.transaction || options.transaction.finished)) {
|
|
||||||
await transaction.commit();
|
|
||||||
}
|
|
||||||
|
|
||||||
setTimeout(() => this.dispatch(execution));
|
setTimeout(() => this.dispatch(execution));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user