fix(dispatcher): ensure workers exit reliably when worker count is low #86
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.
This pull request includes changes to the
.github/workflows/main.yml
andpool.go
files to enhance compatibility and improve the worker management logic. The most important changes include adding Windows OS to the CI workflow and refactoring the worker management logic to simplify the code and avoid potential deadlocks.CI Workflow Enhancements:
.github/workflows/main.yml
: Addedwindows-latest
to the list of operating systems in the matrix strategy to ensure compatibility across more environments.Worker Management Refactoring:
pool.go
: IntroducedNUM_CPU
variable to store the number of CPUs and used it to defineMAX_TASKS_CHAN_LENGTH
.pool.go
: Simplified thestartWorker
function by removing thecanExitDuringDispatch
parameter and updating theworker
function call accordingly.pool.go
: Refactored theworkerCanExit
function to remove thecanExitDuringDispatch
parameter and added a check to allow worker exit if the number of workers exceeds the number of CPUs.pool.go
: Updated theworker
function to call the refactoredworkerCanExit
function without thecanExitDuringDispatch
parameter.