repositories
/
poolifier.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
feat: add worker info to worker nodes
[poolifier.git]
/
src
/
worker
/
abstract-worker.ts
diff --git
a/src/worker/abstract-worker.ts
b/src/worker/abstract-worker.ts
index 25be4820a0e8c59faa8917e0a809633c0d97de83..242c46982236357626ae50fae5f3a33d7c3f04eb 100644
(file)
--- a/
src/worker/abstract-worker.ts
+++ b/
src/worker/abstract-worker.ts
@@
-36,6
+36,10
@@
export abstract class AbstractWorker<
Data = unknown,
Response = unknown
> extends AsyncResource {
Data = unknown,
Response = unknown
> extends AsyncResource {
+ /**
+ * Worker Id.
+ */
+ protected abstract id: number
/**
* Task function(s) processed by the worker when the pool's `execution` function is invoked.
*/
/**
* Task function(s) processed by the worker when the pool's `execution` function is invoked.
*/
@@
-225,6
+229,7
@@
export abstract class AbstractWorker<
this.sendToMainWorker({
data: res,
taskPerformance,
this.sendToMainWorker({
data: res,
taskPerformance,
+ workerId: this.id,
id: message.id
})
} catch (e) {
id: message.id
})
} catch (e) {
@@
-234,6
+239,7
@@
export abstract class AbstractWorker<
message: err,
data: message.data
},
message: err,
data: message.data
},
+ workerId: this.id,
id: message.id
})
} finally {
id: message.id
})
} finally {
@@
-258,6
+264,7
@@
export abstract class AbstractWorker<
this.sendToMainWorker({
data: res,
taskPerformance,
this.sendToMainWorker({
data: res,
taskPerformance,
+ workerId: this.id,
id: message.id
})
return null
id: message.id
})
return null
@@
-269,6
+276,7
@@
export abstract class AbstractWorker<
message: err,
data: message.data
},
message: err,
data: message.data
},
+ workerId: this.id,
id: message.id
})
})
id: message.id
})
})