} else {
this.enqueueTask(destinationWorkerNodeKey, task)
}
- ++destinationWorkerNode.usage.tasks.stolen
- if (this.shallUpdateTaskFunctionWorkerUsage(destinationWorkerNodeKey)) {
+ if (destinationWorkerNode?.usage != null) {
+ ++destinationWorkerNode.usage.tasks.stolen
+ }
+ if (
+ this.shallUpdateTaskFunctionWorkerUsage(destinationWorkerNodeKey) &&
+ destinationWorkerNode.getTaskFunctionWorkerUsage(
+ task.name as string
+ ) != null
+ ) {
const taskFunctionWorkerUsage =
destinationWorkerNode.getTaskFunctionWorkerUsage(
task.name as string
} else {
this.enqueueTask(workerNodeKey, task)
}
- ++workerNode.usage.tasks.stolen
- if (this.shallUpdateTaskFunctionWorkerUsage(workerNodeKey)) {
+ if (workerNode?.usage != null) {
+ ++workerNode.usage.tasks.stolen
+ }
+ if (
+ this.shallUpdateTaskFunctionWorkerUsage(workerNodeKey) &&
+ workerNode.getTaskFunctionWorkerUsage(task.name as string) != null
+ ) {
const taskFunctionWorkerUsage = workerNode.getTaskFunctionWorkerUsage(
task.name as string
) as WorkerUsage