}
private redistributeQueuedTasks (workerNodeKey: number): void {
+ if (this.workerNodes.length <= 1) {
+ return
+ }
while (this.tasksQueueSize(workerNodeKey) > 0) {
const destinationWorkerNodeKey = this.workerNodes.reduce(
(minWorkerNodeKey, workerNode, workerNodeKey, workerNodes) => {
eventDetail: WorkerNodeEventDetail,
previousStolenTask?: Task<Data>
): void => {
+ if (this.workerNodes.length <= 1) {
+ return
+ }
const { workerNodeKey } = eventDetail
if (workerNodeKey == null) {
throw new Error(
private readonly handleBackPressureEvent = (
eventDetail: WorkerNodeEventDetail
): void => {
+ if (this.workerNodes.length <= 1) {
+ return
+ }
const { workerId } = eventDetail
const sizeOffset = 1
if ((this.opts.tasksQueueOptions?.size as number) <= sizeOffset) {