Skip to content
Snippets Groups Projects
Unverified Commit d549083c authored by Éloïs's avatar Éloïs
Browse files

[fix] #1234 kill and recreate pow workers for each block

parent 6f01a449
Branches
Tags
No related merge requests found
...@@ -145,11 +145,7 @@ export class Master { ...@@ -145,11 +145,7 @@ export class Master {
cancelWork() { cancelWork() {
this.logger.info(`Cancelling the work on PoW cluster of %s slaves`, this.slaves.length) this.logger.info(`Cancelling the work on PoW cluster of %s slaves`, this.slaves.length)
this.slaves.forEach(s => { this.shutDownWorkers()
s.worker.send({
command: 'cancel'
})
})
// Eventually force the end of current promise // Eventually force the end of current promise
if (this.currentPromise && !this.currentPromise.isFulfilled()) { if (this.currentPromise && !this.currentPromise.isFulfilled()) {
...@@ -175,6 +171,14 @@ export class Master { ...@@ -175,6 +171,14 @@ export class Master {
await Promise.all(this.slaves.map(async (s:any) => { await Promise.all(this.slaves.map(async (s:any) => {
s.worker.kill() s.worker.kill()
})) }))
// Eventually hard kill persistent workers
this.slaves.forEach(s => {
if (!s.worker.isDead()) {
s.worker.kill('SIGKILL')
}
})
cluster.removeListener('exit', this.exitHandler) cluster.removeListener('exit', this.exitHandler)
cluster.removeListener('online', this.onlineHandler) cluster.removeListener('online', this.onlineHandler)
cluster.removeListener('message', this.messageHandler) cluster.removeListener('message', this.messageHandler)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment