repositories
/
poolifier.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
a038b51
)
refactor: add sanity check at getting worker info
author
Jérôme Benoit
<jerome.benoit@sap.com>
Wed, 19 Jul 2023 22:49:12 +0000
(
00:49
+0200)
committer
Jérôme Benoit
<jerome.benoit@sap.com>
Wed, 19 Jul 2023 22:49:12 +0000
(
00:49
+0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
src/pools/abstract-pool.ts
patch
|
blob
|
blame
|
history
diff --git
a/src/pools/abstract-pool.ts
b/src/pools/abstract-pool.ts
index ddf4cbccd64f0f29e70b7f2994b4c2cc543626f3..be1402a7eccf3e9a81d5e7736f61ed7751d1720a 100644
(file)
--- a/
src/pools/abstract-pool.ts
+++ b/
src/pools/abstract-pool.ts
@@
-1066,7
+1066,11
@@
export abstract class AbstractPool<
* @param worker - The worker.
*/
protected getWorkerInfoByWorker (worker: Worker): WorkerInfo {
- return this.workerNodes[this.getWorkerNodeKey(worker)].info
+ const workerNodeKey = this.getWorkerNodeKey(worker)
+ if (workerNodeKey === -1) {
+ throw new Error('Worker not found')
+ }
+ return this.workerNodes[workerNodeKey].info
}
/**