Skip to content

Commit

Permalink
[Docs] Remove incorrect condition/extra code from example
Browse files Browse the repository at this point in the history
  • Loading branch information
Miguel Aniceto committed Feb 8, 2023
1 parent 6575db1 commit aff5f90
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions docs/parallel.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,19 +44,14 @@ setParallelCanAssign(function (pickleInQuestion, picklesInProgress) {
})
```

Additionally, you can make use of the third argument to get information regarding the worker and decide weather or not to run a scenario.
Additionally, you can make use of the third argument to get information regarding the worker and decide wether or not to run a scenario.

Example:
```javascript
setParallelCanAssign(function (pickleInQuestion, picklesInProgress, worker) {
const inQuestionTags = pickleInQuestion.tags.map(tag => tag.name);
// Does the scenario have a tag that matches this worker (E.g. @WORKER_0)?
if (inQuestionTags.includes(`WORKER_${worker.id}`)) {
// If there's already a scenario inProgress for this worker, don't run it
return picklesInProgress.every((p) => !p.tags.map(t=> t.name).includes(`WORKER_${worker.id}`))
}
// No other restrictions
return true
return inQuestionTags.includes(`WORKER_${worker.id}`);
})
```

Expand Down

0 comments on commit aff5f90

Please sign in to comment.