repositories
/
poolifier.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
chore: v2.6.24
[poolifier.git]
/
src
/
worker
/
abstract-worker.ts
diff --git
a/src/worker/abstract-worker.ts
b/src/worker/abstract-worker.ts
index 1b34fb139dd7d0d6513a298be184c5c342d8bcef..64627efb8823198c6cb09c81fbdded3bef046f01 100644
(file)
--- a/
src/worker/abstract-worker.ts
+++ b/
src/worker/abstract-worker.ts
@@
-243,7
+243,7
@@
export abstract class AbstractWorker<
* @returns The names of the worker's task functions.
*/
public listTaskFunctions (): string[] {
* @returns The names of the worker's task functions.
*/
public listTaskFunctions (): string[] {
- return
Array.from(this.taskFunctions.keys())
+ return
[...this.taskFunctions.keys()]
}
/**
}
/**
@@
-293,7
+293,9
@@
export abstract class AbstractWorker<
* @param message - The received message.
*/
protected messageListener (message: MessageValue<Data>): void {
* @param message - The received message.
*/
protected messageListener (message: MessageValue<Data>): void {
- if (message.workerId === this.id) {
+ if (message.workerId != null && message.workerId !== this.id) {
+ throw new Error('Message worker id does not match worker id')
+ } else if (message.workerId === this.id) {
if (message.statistics != null) {
// Statistics message received
this.statistics = message.statistics
if (message.statistics != null) {
// Statistics message received
this.statistics = message.statistics
@@
-302,7
+304,7
@@
export abstract class AbstractWorker<
!this.isMain && message.checkActive
? this.startCheckActive()
: this.stopCheckActive()
!this.isMain && message.checkActive
? this.startCheckActive()
: this.stopCheckActive()
- } else if (message.
i
d != null && message.data != null) {
+ } else if (message.
taskI
d != null && message.data != null) {
// Task message received
this.run(message)
} else if (message.kill === true) {
// Task message received
this.run(message)
} else if (message.kill === true) {
@@
-422,7
+424,7
@@
export abstract class AbstractWorker<
data: res,
taskPerformance,
workerId: this.id,
data: res,
taskPerformance,
workerId: this.id,
-
id: task.i
d
+
taskId: task.taskI
d
})
} catch (e) {
const errorMessage = this.handleError(e as Error | string)
})
} catch (e) {
const errorMessage = this.handleError(e as Error | string)
@@
-433,7
+435,7
@@
export abstract class AbstractWorker<
data: task.data
},
workerId: this.id,
data: task.data
},
workerId: this.id,
-
id: task.i
d
+
taskId: task.taskI
d
})
} finally {
this.updateLastTaskTimestamp()
})
} finally {
this.updateLastTaskTimestamp()
@@
-458,7
+460,7
@@
export abstract class AbstractWorker<
data: res,
taskPerformance,
workerId: this.id,
data: res,
taskPerformance,
workerId: this.id,
-
id: task.i
d
+
taskId: task.taskI
d
})
return null
})
})
return null
})
@@
-471,7
+473,7
@@
export abstract class AbstractWorker<
data: task.data
},
workerId: this.id,
data: task.data
},
workerId: this.id,
-
id: task.i
d
+
taskId: task.taskI
d
})
})
.finally(() => {
})
})
.finally(() => {