fix(plugin-workflow): queueing execution of disabled workflow block dispatching (#3256)
* fix(plugin-workflow): queueing execution of disabled workflow block dispatching * fix(plugin-workflow): fix typo
This commit is contained in:
parent
cc2b132aa1
commit
f17e10caa4
@ -398,6 +398,7 @@ export default class WorkflowPlugin extends Plugin {
|
||||
const execution = (await this.db.getRepository('executions').findOne({
|
||||
filter: {
|
||||
status: EXECUTION_STATUS.QUEUEING,
|
||||
'workflow.enabled': true,
|
||||
'workflow.id': {
|
||||
[Op.not]: null,
|
||||
},
|
||||
@ -405,7 +406,7 @@ export default class WorkflowPlugin extends Plugin {
|
||||
appends: ['workflow'],
|
||||
sort: 'createdAt',
|
||||
})) as ExecutionModel;
|
||||
if (execution && execution.workflow.enabled) {
|
||||
if (execution) {
|
||||
this.getLogger(execution.workflowId).info(`execution (${execution.id}) fetched from db`);
|
||||
next = [execution];
|
||||
}
|
||||
|
@ -356,10 +356,8 @@ describe('workflow > Plugin', () => {
|
||||
const p1 = await PostRepo.create({ values: { title: 't1' } });
|
||||
|
||||
const ExecutionModel = db.getCollection('executions').model;
|
||||
const e1 = await ExecutionModel.create({
|
||||
workflowId: w1.id,
|
||||
const e1 = await w1.createExecution({
|
||||
key: w1.key,
|
||||
useTransaction: w1.useTransaction,
|
||||
context: {
|
||||
data: p1.get(),
|
||||
},
|
||||
@ -378,10 +376,25 @@ describe('workflow > Plugin', () => {
|
||||
|
||||
await db.reconnect();
|
||||
|
||||
const e2 = await ExecutionModel.create({
|
||||
workflowId: w1.id,
|
||||
const e2 = await w1.createExecution({
|
||||
key: w1.key,
|
||||
useTransaction: w1.useTransaction,
|
||||
context: {
|
||||
data: p1.get(),
|
||||
},
|
||||
createdAt: p1.createdAt,
|
||||
});
|
||||
|
||||
const w2 = await WorkflowModel.create({
|
||||
enabled: true,
|
||||
type: 'collection',
|
||||
config: {
|
||||
mode: 1,
|
||||
collection: 'posts',
|
||||
},
|
||||
});
|
||||
|
||||
const e3 = await w2.createExecution({
|
||||
key: w2.key,
|
||||
context: {
|
||||
data: p1.get(),
|
||||
},
|
||||
@ -393,6 +406,10 @@ describe('workflow > Plugin', () => {
|
||||
|
||||
await e2.reload();
|
||||
expect(e2.status).toBe(EXECUTION_STATUS.QUEUEING);
|
||||
|
||||
// queueing execution of disabled workflow should not effect other executions
|
||||
await e3.reload();
|
||||
expect(e3.status).toBe(EXECUTION_STATUS.RESOLVED);
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -13,11 +13,6 @@ export default {
|
||||
type: 'uid',
|
||||
name: 'key',
|
||||
},
|
||||
{
|
||||
type: 'boolean',
|
||||
name: 'useTransaction',
|
||||
defaultValue: false,
|
||||
},
|
||||
{
|
||||
type: 'hasMany',
|
||||
name: 'jobs',
|
||||
|
Loading…
Reference in New Issue
Block a user