- : this.currentWorkerId + 1
- this.setWorkerTaskRunTime(
- this.pool.workers.get(this.currentWorkerId)?.worker as Worker,
- workerTaskWeight,
- 0
- )
+ : this.currentWorkerNodeId + 1
+ this.setWorkerTaskRunTime(this.currentWorkerNodeId, workerTaskWeight, 0)
+ }
+ return chosenWorkerNodeKey
+ }
+
+ /** @inheritDoc */
+ public remove (workerNodeKey: number): boolean {
+ if (this.currentWorkerNodeId === workerNodeKey) {
+ if (this.pool.workerNodes.length === 0) {
+ this.currentWorkerNodeId = 0
+ } else {
+ this.currentWorkerNodeId =
+ this.currentWorkerNodeId > this.pool.workerNodes.length - 1
+ ? this.pool.workerNodes.length - 1
+ : this.currentWorkerNodeId
+ }
+ }
+ const deleted = this.workersTaskRunTime.delete(workerNodeKey)
+ for (const [key, value] of this.workersTaskRunTime) {
+ if (key > workerNodeKey) {
+ this.workersTaskRunTime.set(key - 1, value)
+ }