Skip to content

Commit

Permalink
docs: added comments
Browse files Browse the repository at this point in the history
  • Loading branch information
analog-nico committed Feb 21, 2019
1 parent c3cff4b commit ebbf9fe
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions lib/task/TaskDispatchTracker.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ class TaskDispatchTracker {

trackTaskStopped(name) {

// Must unregister task synchronously in this function to avoid race conditions

this._concurrentTasks -= 1

this._taskMap.get(name).concurrentTasks -= 1
Expand Down
2 changes: 1 addition & 1 deletion lib/task/TaskDispatcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ class TaskDispatcher {
let wasAtMaxCapacity = this._taskDispatchTracker.reachedMaxCapacity()
let wasAtMaxCapacityForTask = this._taskDispatchTracker.reachedMaxCapacityForTask(task.name)

this._taskDispatchTracker.trackTaskStopped(task.name)
this._taskDispatchTracker.trackTaskStopped(task.name) // Must be called synchronously before _pollForTask to avoid race conditions

let isNowAtMaxCapacity = this._taskDispatchTracker.reachedMaxCapacity()
let isNowAtMaxCapacityForTask = this._taskDispatchTracker.reachedMaxCapacityForTask(task.name)
Expand Down

0 comments on commit ebbf9fe

Please sign in to comment.