gun subprocess now checks its death
This commit is contained in:
parent
6d2ebbcc36
commit
7c142aa4dd
1 changed files with 11 additions and 0 deletions
|
|
@ -65,10 +65,21 @@ const waitForAuth = async () => {
|
||||||
return waitForAuth()
|
return waitForAuth()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let dead = false
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {Smith.SmithMsg} msg
|
* @param {Smith.SmithMsg} msg
|
||||||
*/
|
*/
|
||||||
const handleMsg = async msg => {
|
const handleMsg = async msg => {
|
||||||
|
if (dead) {
|
||||||
|
logger.error('Dead sub-process received msg: ', msg)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
// @ts-ignore
|
||||||
|
if (msg === 'bye') {
|
||||||
|
logger.info('KILLING')
|
||||||
|
dead = true
|
||||||
|
}
|
||||||
if (Array.isArray(msg)) {
|
if (Array.isArray(msg)) {
|
||||||
msg.forEach(handleMsg)
|
msg.forEach(handleMsg)
|
||||||
return
|
return
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue