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

Update documentation and examples for pool.terminate. #57

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ pool.exec(add, [3, 4])
console.error(err);
})
.then(function () {
pool.terminate(); // terminate all workers when done
return pool.terminate(); // terminate all workers when done
});
```

Expand Down Expand Up @@ -127,7 +127,7 @@ pool.exec('fibonacci', [10])
console.error(err);
})
.then(function () {
pool.terminate(); // terminate all workers when done
return pool.terminate(); // terminate all workers when done
});

// or run registered functions on the worker via a proxy:
Expand All @@ -142,7 +142,7 @@ pool.proxy()
console.error(err);
})
.then(function () {
pool.terminate(); // terminate all workers when done
return pool.terminate(); // terminate all workers when done
});
```

Expand Down Expand Up @@ -221,9 +221,9 @@ A worker pool contains the following functions:
}
```

- `Pool.terminate([force: boolean [, timeout: number]])`
- `Pool.terminate([force: boolean [, timeout: number]]) : Promise.<*, Error>`<br>

If parameter `force` is false (default), workers will finish the tasks they are working on before terminating themselves. When `force` is true, all workers are terminated immediately without finishing running tasks. If `timeout` is provided, worker will be forced to terminal when the timeout expires and the worker has not finished.
If parameter `force` is false (default), workers will finish the tasks they are working on before terminating themselves. When `force` is true, all workers are terminated immediately without finishing running tasks. If `timeout` is provided, worker will be forced to terminate when the timeout expires and the worker has not finished.

- `Pool.clear([force: boolean])`<br>
*Deprecated: use `Pool.terminate` instead*<br>.
Expand Down
2 changes: 1 addition & 1 deletion examples/async.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ pool.proxy()
console.error(err);
})
.then(function () {
pool.terminate(); // terminate all workers when done
return pool.terminate(); // terminate all workers when done
});
2 changes: 1 addition & 1 deletion examples/dedicatedWorker.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ pool.exec('fibonacci', [10])
console.error(err);
})
.then(function () {
pool.terminate(); // terminate all workers when done
return pool.terminate(); // terminate all workers when done
});
2 changes: 1 addition & 1 deletion examples/offloadFunctions.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ pool.exec(add, [3, 4])
console.error(err);
})
.then(function () {
pool.terminate(); // terminate all workers when done
return pool.terminate(); // terminate all workers when done
});
2 changes: 1 addition & 1 deletion examples/proxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ pool.proxy()
console.error(err);
})
.then(function () {
pool.terminate(); // terminate all workers when done
return pool.terminate(); // terminate all workers when done
});