Smart Worker Queue Drain: Graceful Shutdown Enhancement #15
Labels
No labels
Epic
Feature Request
HOLD
audit
automerge
bug
dependencies
documentation
duplicate
good first issue
help wanted
invalid
question
release
security
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
NiXTheDev/regexYbot#15
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Overview
Enhance the graceful shutdown mechanism to intelligently drain the worker queue instead of immediately rejecting pending tasks.
Current Behavior
During shutdown, queued tasks are immediately rejected and workers are terminated.
Proposed Enhancement
Instead of rejecting tasks, queue all pending Telegram updates and process them before shutting down.
Technical Requirements
Core Features
Configuration
Implementation Considerations
Use Case
This would be useful in production deployments where you don't want to lose pending regex operations during a deployment or restart.
Notes
Priority: Low-Medium
Estimated Effort: Medium
Depends on: Worker Pool v2 (issue #14) for dynamic scaling
✅ Implementation Complete
All graceful shutdown enhancement features have been implemented:
Configuration Options Added
GRACEFUL_DRAIN(default:false) - Enable graceful draining during shutdownGRACEFUL_DRAIN_TIMEOUT_MS(default:8000, max:9500) - Max time to drain queueImplementation Details
CONFIG.GRACEFUL_DRAINworkerPool.shutdown({ drainTasks: true, drainTimeoutMs })Docker Compatibility
GRACEFUL_DRAIN_TIMEOUT_MSenv varSafety
false(immediate shutdown) for safetyTests
Commit:
de45141All requirements implemented. Graceful drain is now available via configuration. Default behavior remains safe (immediate shutdown). Docker-compatible timeout settings included.