Skip to content

Commit

Permalink
[cucumber#1044] Using variable for workers instead of repeating _.val…
Browse files Browse the repository at this point in the history
…ues.

No need for oneWokeWorker check. inProgressPickles is adequate for starters
  • Loading branch information
eman2673 committed Feb 25, 2021
1 parent 9223aba commit 587187d
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/runtime/parallel/coordinator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,16 +153,19 @@ export default class Coordinator {
}

awakenWorkers(): void {
let oneWokeWorker = false
_.forOwn(this.workers, (worker): boolean => {
const workers = _.values(this.workers)
_.every(workers, (worker): boolean => {
if (worker.idle) {
this.giveWork(worker)
}
return (oneWokeWorker = oneWokeWorker || !worker.idle)
return !worker.idle
})

if (!oneWokeWorker && _.isEmpty(this.inProgressPickles)) {
_.values(this.workers).forEach((worker) => {
if (
_.isEmpty(this.inProgressPickles) &&
_.every(workers, (worker) => worker.idle)
) {
_.each(this.workers, (worker) => {
if (!worker.closed) {
this.closeWorker(worker)
}
Expand Down

0 comments on commit 587187d

Please sign in to comment.