repositories
/
poolifier.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
7629bdf
)
refactor: add worker id sanity check at message handling
author
Jérôme Benoit
<jerome.benoit@sap.com>
Sat, 5 Aug 2023 10:59:14 +0000
(12:59 +0200)
committer
Jérôme Benoit
<jerome.benoit@sap.com>
Sat, 5 Aug 2023 10:59:14 +0000
(12:59 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
src/worker/abstract-worker.ts
patch
|
blob
|
blame
|
history
diff --git
a/src/worker/abstract-worker.ts
b/src/worker/abstract-worker.ts
index b9e3deb08676f27aa7f2ab637e060f449811c11c..64627efb8823198c6cb09c81fbdded3bef046f01 100644
(file)
--- a/
src/worker/abstract-worker.ts
+++ b/
src/worker/abstract-worker.ts
@@
-293,7
+293,9
@@
export abstract class AbstractWorker<
* @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