refactor: order condition check on worker message
authorJérôme Benoit <jerome.benoit@sap.com>
Thu, 13 Apr 2023 13:58:49 +0000 (15:58 +0200)
committerJérôme Benoit <jerome.benoit@sap.com>
Thu, 13 Apr 2023 13:58:49 +0000 (15:58 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
src/worker/abstract-worker.ts

index b588b181fa1720bb44fc8b76d4dbafe847743364..7563e97bf5cadf01b296ed1811def122d6e875dc 100644 (file)
@@ -85,7 +85,7 @@ export abstract class AbstractWorker<
     message: MessageValue<Data, MainWorker>,
     fn: (data: Data) => Response
   ): void {
-    if (message.data != null && message.id != null) {
+    if (message.id != null && message.data != null) {
       // Task message received
       if (this.opts.async === true) {
         this.runInAsyncScope(this.runAsync.bind(this), this, fn, message)