refactor: silence rollup warning
authorJérôme Benoit <jerome.benoit@piment-noir.org>
Tue, 22 Aug 2023 21:54:14 +0000 (23:54 +0200)
committerJérôme Benoit <jerome.benoit@piment-noir.org>
Tue, 22 Aug 2023 21:54:14 +0000 (23:54 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
src/pools/worker-node.ts
src/utils.ts

index 208acdab423bc3293aa603165c05ef4bb44da31a..d8044032014d02d36e6cbe70ffd10026f6a085ea 100644 (file)
@@ -94,7 +94,7 @@ implements IWorkerNode<Worker, Data> {
   public enqueueTask (task: Task<Data>): number {
     const tasksQueueSize = this.tasksQueue.push(task)
     if (this.onBackPressure != null && this.hasBackPressure()) {
-      once(this.onBackPressure)(this.info.id as number)
+      once(this.onBackPressure, this)(this.info.id as number)
     }
     return tasksQueueSize
   }
@@ -103,7 +103,7 @@ implements IWorkerNode<Worker, Data> {
   public unshiftTask (task: Task<Data>): number {
     const tasksQueueSize = this.tasksQueue.unshift(task)
     if (this.onBackPressure != null && this.hasBackPressure()) {
-      once(this.onBackPressure)(this.info.id as number)
+      once(this.onBackPressure, this)(this.info.id as number)
     }
     return tasksQueueSize
   }
index 7927c9738c39d2ad1a417e4a2afdc552ece34caa..6f9d1226bb71210b020d987b32d169bbd593b5b8 100644 (file)
@@ -193,7 +193,7 @@ export const updateMeasurementStatistics = (
 export const once = (
   // eslint-disable-next-line @typescript-eslint/no-explicit-any
   fn: (...args: any[]) => void,
-  context = this
+  context: unknown
   // eslint-disable-next-line @typescript-eslint/no-explicit-any
 ): ((...args: any[]) => void) => {
   let called = false