Worker Pool v2: Dynamic Scaling with Lazy Initialization #14
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#14
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
Implement a v2 worker pool with dynamic scaling capabilities to optimize resource usage and improve performance under varying loads.
Goals
Technical Requirements
Core Features
Track per-worker queue length or load metricsArchitecture changed to one fifo queueDispatch tasks to least-loaded workerArchitecture changed. workers consume from one queue, post back to it in case sed commands are chainedIdle Management
Track last-active time per workerGlobal timerTesting
Notes
Priority: Medium-High
Estimated Effort: Large (separate branch recommended)
Additional Task from TODO item 9
When Worker Pool v2 is completed, update the changelog with an entry explaining:
This ensures future contributors understand the evolution of the worker pool system.
✅ Implementation Complete
All WorkerPoolV2 features have been implemented and merged to
devbranch:Core Features
initialWorkers(default: 1), scales as neededShutdown Enhancements
drainTasks: true, pool spawns workers equal to queue size (capped at 20) to process remaining tasks quicklyImplementation Details
spawnWorker(count = 1)- Batch spawn workers, returns count spawnedisShuttingDownstate - Automatically bypasses maxWorkers limit during shutdownunref()on idle check interval - Prevents keeping process aliveTests Added (9 tests)
All 77 tests passing ✅
Commit:
2c8404bAll tasks completed. WorkerPoolV2 fully implemented with dynamic scaling, lazy initialization, and shutdown scaling. Ready for production use.