Skip to content
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(dispatcher): ensure workers exit reliably when worker count is low #86

Merged
merged 1 commit into from
Nov 15, 2024

Conversation

alitto
Copy link
Owner

@alitto alitto commented Nov 15, 2024

This pull request includes changes to the .github/workflows/main.yml and pool.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: Added windows-latest to the list of operating systems in the matrix strategy to ensure compatibility across more environments.

Worker Management Refactoring:

  • pool.go: Introduced NUM_CPU variable to store the number of CPUs and used it to define MAX_TASKS_CHAN_LENGTH.
  • pool.go: Simplified the startWorker function by removing the canExitDuringDispatch parameter and updating the worker function call accordingly.
  • pool.go: Refactored the workerCanExit function to remove the canExitDuringDispatch parameter and added a check to allow worker exit if the number of workers exceeds the number of CPUs.
  • pool.go: Updated the worker function to call the refactored workerCanExit function without the canExitDuringDispatch parameter.

Copy link

codecov bot commented Nov 15, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.52%. Comparing base (9f8d16a) to head (1d93c12).
Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main      #86   +/-   ##
=======================================
  Coverage   95.52%   95.52%           
=======================================
  Files          14       14           
  Lines         849      849           
=======================================
  Hits          811      811           
  Misses         34       34           
  Partials        4        4           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@alitto alitto merged commit d1e5a78 into main Nov 15, 2024
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant