- /** {@inheritDoc} */
- public remove (workerKey: number): boolean {
- if (this.nextWorkerId === workerKey) {
- this.nextWorkerId =
- this.nextWorkerId > this.pool.workers.length - 1
- ? this.pool.workers.length - 1
- : this.nextWorkerId
+ /** @inheritDoc */
+ public remove (workerNodeKey: number): boolean {
+ if (this.nextWorkerNodeId === workerNodeKey) {
+ if (this.pool.workerNodes.length === 0) {
+ this.nextWorkerNodeId = 0
+ } else {
+ this.nextWorkerNodeId =
+ this.nextWorkerNodeId > this.pool.workerNodes.length - 1
+ ? this.pool.workerNodes.length - 1
+ : this.nextWorkerNodeId
+ }