Merge branch 'master' into feature/task-functions
[poolifier.git] / src / worker / abstract-worker.ts
index bc62ade55ef15efac79c8c9e8835a45cb697aa40..bd03d86e06eefee9871215a49aeb11343236be0d 100644 (file)
@@ -326,6 +326,7 @@ export abstract class AbstractWorker<
         DEFAULT_TASK_NAME,
         this.taskFunctions.get(name) as TaskFunction<Data, Response>
       )
+      this.sendTaskFunctionNamesToMainWorker()
       return { status: true }
     } catch (error) {
       return { status: false, error: error as Error }
@@ -376,7 +377,7 @@ export abstract class AbstractWorker<
   protected handleTaskFunctionOperationMessage (
     message: MessageValue<Data>
   ): void {
-    const { taskFunctionOperation, taskFunction, taskFunctionName } = message
+    const { taskFunctionOperation, taskFunctionName, taskFunction } = message
     let response!: TaskFunctionOperationReturnType
     if (taskFunctionOperation === 'add') {
       response = this.addTaskFunction(
@@ -385,7 +386,7 @@ export abstract class AbstractWorker<
         new Function(`return ${taskFunction as string}`)() as TaskFunction<
         Data,
         Response
-        >
+        > /* NOSONAR */
       )
     } else if (taskFunctionOperation === 'remove') {
       response = this.removeTaskFunction(taskFunctionName as string)
@@ -606,7 +607,7 @@ export abstract class AbstractWorker<
           taskPerformance,
           taskId
         })
-        return null
+        return undefined
       })
       .catch(error => {
         this.sendToMainWorker({