tests: prevent race condition by inserting RUNNING execution directly
This commit is contained in:
@@ -761,7 +761,9 @@ describe('WorkflowService', () => {
|
|||||||
// Insert a RUNNING execution directly to avoid racing with the background
|
// Insert a RUNNING execution directly to avoid racing with the background
|
||||||
// step processor that startExecution kicks off (a trigger-only workflow can
|
// step processor that startExecution kicks off (a trigger-only workflow can
|
||||||
// transition to COMPLETED before the second call observes it as RUNNING).
|
// transition to COMPLETED before the second call observes it as RUNNING).
|
||||||
const triggerStep = workflow.steps.find(step => step.type === WorkflowStepType.TRIGGER);
|
const triggerStep = await prisma.workflowStep.findFirst({
|
||||||
|
where: {workflowId: workflow.id, type: WorkflowStepType.TRIGGER},
|
||||||
|
});
|
||||||
await prisma.workflowExecution.create({
|
await prisma.workflowExecution.create({
|
||||||
data: {
|
data: {
|
||||||
workflowId: workflow.id,
|
workflowId: workflow.id,
|
||||||
|
|||||||
Reference in New Issue
Block a user