feat: graceful drain for workflow engine deletion#21993
Draft
feat: graceful drain for workflow engine deletion#21993
Conversation
Prevent new executions from starting when a delete/pause event is pending, and defer deletion until all in-flight executions complete. This avoids blocking the reconciliation loop (1 of 12 semaphore slots) while waiting for long-running executions to finish. Changes: - Add Drain(), IsDraining(), ActiveExecutions() to workflow engine v2 - Add DrainableService interface for type-safe drain detection - Two-phase delete: drain (non-blocking) then close (fast once drained) - Fix herr/err variable shadowing in WorkflowDeleted/Paused handlers - Ignore ErrAlreadyStopped on Close() retry to prevent permanent loops - Detect draining engines in registration handler to allow replacement - Add drainingWorkflows metric gauge for operator visibility
Contributor
|
I see you updated files related to
|
Contributor
|
✅ No conflicts with other open PRs targeting |
- revive: simplify early-return in workflowRegisteredEvent drain check - perfsprint: use errors.New instead of fmt.Errorf without format args - unused: remove unwired recordDrainingWorkflow method (metric gauge kept)
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.




Summary
Test plan