+ * Checks if the given worker is registered in the workers tasks usage map.
+ *
+ * @param worker Worker to check.
+ * @returns `true` if the worker is registered in the workers tasks usage map. `false` otherwise.
+ */
+ private checkWorkerTasksUsage (worker: Worker): boolean {
+ const hasTasksUsage = this.workersTasksUsage.has(worker)
+ if (!hasTasksUsage) {
+ throw new Error('Worker could not be found in workers tasks usage map')
+ }
+ return hasTasksUsage
+ }
+
+ /**
+ * Initializes tasks usage statistics.