+ /** @inheritdoc */
+ public deleteTaskFunctionWorkerUsage (name: string): boolean {
+ return this.taskFunctionsUsage.delete(name)
+ }
+
+ private async startOnEmptyQueue (): Promise<void> {
+ if (
+ this.onEmptyQueueCount > 0 &&
+ (this.usage.tasks.executing > 0 || this.tasksQueue.size > 0)
+ ) {
+ this.onEmptyQueueCount = 0
+ return
+ }
+ ++this.onEmptyQueueCount
+ this.dispatchEvent(
+ new CustomEvent<WorkerNodeEventDetail>('emptyqueue', {
+ detail: { workerId: this.info.id as number }
+ })
+ )
+ await sleep(exponentialDelay(this.onEmptyQueueCount))
+ await this.startOnEmptyQueue()
+ }
+
+ private initWorkerInfo (worker: Worker): WorkerInfo {