Silence a sonar code smell
authorJérôme Benoit <jerome.benoit@sap.com>
Mon, 18 Apr 2022 08:03:50 +0000 (10:03 +0200)
committerJérôme Benoit <jerome.benoit@sap.com>
Mon, 18 Apr 2022 08:03:50 +0000 (10:03 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
src/worker/abstract-worker.ts

index 0883b03eb0b5e6587892b5e6456745e8ce53cdd6..3a8414d84ff7aba6d8524d908a3b53094f583fa4 100644 (file)
@@ -21,6 +21,10 @@ export abstract class AbstractWorker<
   Data = unknown,
   Response = unknown
 > extends AsyncResource {
+  /**
+   * Options for the worker.
+   */
+  public readonly opts: WorkerOptions
   /**
    * Timestamp of the last task processed by this worker.
    */
@@ -44,7 +48,7 @@ export abstract class AbstractWorker<
     isMain: boolean,
     fn: (data: Data) => Response,
     protected mainWorker: MainWorker | undefined | null,
-    public readonly opts: WorkerOptions = {
+    opts: WorkerOptions = {
       /**
        * The kill behavior option on this Worker or its default value.
        */
@@ -57,6 +61,7 @@ export abstract class AbstractWorker<
     }
   ) {
     super(type)
+    this.opts = opts
     this.checkFunctionInput(fn)
     this.checkWorkerOptions(this.opts)
     this.lastTaskTimestamp = Date.now()