## [Unreleased]
+### Fixed
+
+- Ensure dynamic pool does not alter worker choice strategy expected behavior.
+
## [2.4.0] - 2023-04-04
### Added
function factorial (n) {
if (n === 0) {
return 1
- } else {
- return factorial(n - 1) * n
}
+ return factorial(n - 1) * n
}
function executeWorkerFunction (data) {
/** {@inheritDoc} */
public choose (): number {
- const freeWorkerKey = this.pool.findFreeWorkerKey()
- if (freeWorkerKey !== -1) {
- return freeWorkerKey
- }
-
if (this.pool.busy) {
return this.workerChoiceStrategy.choose()
}
-
- // All workers are busy, create a new worker
- return this.createWorkerCallback()
+ const freeWorkerKey = this.pool.findFreeWorkerKey()
+ if (freeWorkerKey === -1) {
+ return this.createWorkerCallback()
+ }
+ return this.workerChoiceStrategy.choose()
}
/** {@inheritDoc} */
/** {@inheritDoc} */
public choose (): number {
const freeWorkerKey = this.pool.findFreeWorkerKey()
- if (!this.isDynamicPool && freeWorkerKey !== -1) {
+ if (freeWorkerKey !== -1) {
return freeWorkerKey
}
let minRunTime = Infinity
/** {@inheritDoc} */
public choose (): number {
const freeWorkerKey = this.pool.findFreeWorkerKey()
- if (!this.isDynamicPool && freeWorkerKey !== -1) {
+ if (freeWorkerKey !== -1) {
return freeWorkerKey
}
let minNumberOfTasks = Infinity