repositories
/
poolifier.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
docs: fixlet to code comment
[poolifier.git]
/
src
/
pools
/
abstract-pool.ts
diff --git
a/src/pools/abstract-pool.ts
b/src/pools/abstract-pool.ts
index 4c78c28f1479f7988e10a9096710e1ec2e94c7cb..473789809d2dde4ea57571dd1a2ded5dd7499477 100644
(file)
--- a/
src/pools/abstract-pool.ts
+++ b/
src/pools/abstract-pool.ts
@@
-7,13
+7,13
@@
import {
} from '../utils'
import { KillBehaviors, isKillBehavior } from '../worker/worker-options'
import {
} from '../utils'
import { KillBehaviors, isKillBehavior } from '../worker/worker-options'
import {
+ PoolEmitter,
PoolEvents,
type IPool,
type PoolOptions,
type TasksQueueOptions,
PoolType
} from './pool'
PoolEvents,
type IPool,
type PoolOptions,
type TasksQueueOptions,
PoolType
} from './pool'
-import { PoolEmitter } from './pool'
import type { IWorker, Task, TasksUsage, WorkerNode } from './worker'
import {
WorkerChoiceStrategies,
import type { IWorker, Task, TasksUsage, WorkerNode } from './worker'
import {
WorkerChoiceStrategies,
@@
-296,14
+296,11
@@
export abstract class AbstractPool<
protected abstract get busy (): boolean
protected internalBusy (): boolean {
protected abstract get busy (): boolean
protected internalBusy (): boolean {
- return this.findFreeWorkerNodeKey() === -1
- }
-
- /** @inheritDoc */
- public findFreeWorkerNodeKey (): number {
- return this.workerNodes.findIndex(workerNode => {
- return workerNode.tasksUsage?.running === 0
- })
+ return (
+ this.workerNodes.findIndex(workerNode => {
+ return workerNode.tasksUsage?.running === 0
+ }) === -1
+ )
}
/** @inheritDoc */
}
/** @inheritDoc */
@@
-431,7
+428,7
@@
export abstract class AbstractPool<
) {
// Kill message received from the worker: no new tasks are submitted to that worker for a while ( > maxInactiveTime)
this.flushTasksQueueByWorker(workerCreated)
) {
// Kill message received from the worker: no new tasks are submitted to that worker for a while ( > maxInactiveTime)
this.flushTasksQueueByWorker(workerCreated)
- void
this.destroyWorker(workerCreated
)
+ void
(this.destroyWorker(workerCreated) as Promise<void>
)
}
})
workerNodeKey = this.getWorkerNodeKey(workerCreated)
}
})
workerNodeKey = this.getWorkerNodeKey(workerCreated)