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

Rotate workers when they are all idling #4921

Merged
merged 1 commit into from
Nov 20, 2017
Merged

Rotate workers when they are all idling #4921

merged 1 commit into from
Nov 20, 2017

Conversation

mjesun
Copy link
Contributor

@mjesun mjesun commented Nov 20, 2017

When all workers are idling (i.e. they are not doing any work), worker 1 keeps getting all the jobs. This is due to the for loop that pushes sequentially all jobs from worker 0 to worker n-1. Unless explicitly wanted (because of a computeWorkerKey present), this is usually not a desired behavior.

Adding an offset and a modulo should do the trick. When all workers are busy, the logic is not affected, though; the first available worker will still pick the job.

@codecov-io
Copy link

Codecov Report

Merging #4921 into master will increase coverage by 0.01%.
The diff coverage is 40%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #4921      +/-   ##
==========================================
+ Coverage   60.01%   60.03%   +0.01%     
==========================================
  Files         198      198              
  Lines        6555     6558       +3     
  Branches        3        3              
==========================================
+ Hits         3934     3937       +3     
  Misses       2621     2621
Impacted Files Coverage Δ
packages/jest-worker/src/index.js 84.93% <40%> (+0.64%) ⬆️
packages/jest-editor-support/src/Runner.js 58.49% <0%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e3364b0...34549f6. Read the comment docs.

@cpojer cpojer merged commit ad1d7f7 into jestjs:master Nov 20, 2017
@cpojer
Copy link
Member

cpojer commented Nov 20, 2017

This is nice

@mjesun mjesun deleted the rotate-workers branch December 6, 2017 11:46
@github-actions
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 13, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants