-
Notifications
You must be signed in to change notification settings - Fork 7.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(core): Fix execution cancellation in scaling mode #9841
Conversation
} | ||
|
||
// queue mode | ||
return await this.executionRepository.stopDuringRun(execution); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be part of the responsibility of activeExecutions
rather than being here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What I like about the flow right now is that it gives a clear overview of all the calls being made to stop the execution, with everything in a single spot:
ExecutionService.stopInRegularMode
ConcurrencyControl.remove
ExecutionRepository.stopBeforeRun
// or
ActiveExecutions.stopExecution
WaitTracker.stopExecution
ExecutionRepository.stopDuringRun
ExecutionService.stopInScalingMode
ExecutionService.stopInRegularMode
// or
WaitTracker.stopExecution
this.queue.stopJob
ExecutionRepository.stopDuringRun
If we moved ExecutionRepository.stopDuringRun
- this would require more navigation to see the full picture and
ExecutionRepository.stopBeforeRun
would still remain inExecutionService
unless we also move that toConcurrencyControl.remove
ExecutionService.stopInRegularMode
ConcurrencyControl.remove
// or
ActiveExecutions.stopExecution
WaitTracker.stopExecution
ExecutionService.stopInScalingMode
ExecutionService.stopInRegularMode
// or
WaitTracker.stopExecution
this.queue.stopJob
The root issue in my eyes is that there is no clear distinction between what ExecutionService
and what ActiveExecutions
should be responsible for. Until we differentiate them better, I'd find the former flow easier to debug.
return await this.waitTracker.stopExecution(execution.id); | ||
} catch { | ||
// @TODO: Why are we swallowing this error in queue mode? | ||
private async stopInScalingMode(execution: IExecutionResponse) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if it's a manual execution? In this case it would be viewable in activeExecutions
and can be cancelled from there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please see dcb93be
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What what I can understand, LGTM.
3 flaky tests on run #5720 ↗︎
Details:
5-ndv.cy.ts • 2 flaky tests
24-ndv-paired-item.cy.ts • 1 flaky test
Review all test suite changes for PR #9841 ↗︎ |
✅ All Cypress E2E specs passed |
Got released with |
While working on #9835 I noticed that execution cancellation is broken in queue mode - cancelling leads to an
error
status instead ofcanceled
and does not remove the job from the queue so it goes through anyway.This PR fixes this issue, refactors cancellation out of
WaitTracker
, and adds tests.https://linear.app/n8n/issue/PAY-1709