mirror of
https://github.com/nocobase/nocobase
synced 2024-11-15 12:56:13 +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 = options.transaction && !options.transaction.finished
|
||||
? options.transaction
|
||||
: await (<typeof WorkflowModel>workflow.constructor).database.sequelize.transaction();
|
||||
const transaction = await (<typeof WorkflowModel>workflow.constructor).database.sequelize.transaction();
|
||||
|
||||
const execution = await workflow.createExecution({
|
||||
context,
|
||||
@ -189,10 +186,7 @@ export default class WorkflowPlugin extends Plugin {
|
||||
|
||||
execution.workflow = workflow;
|
||||
|
||||
// @ts-ignore
|
||||
if (transaction && (!options.transaction || options.transaction.finished)) {
|
||||
await transaction.commit();
|
||||
}
|
||||
|
||||
setTimeout(() => this.dispatch(execution));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user