mirror of
https://github.com/Xahau/Validation-Ledger-Tx-Store-to-xPOP.git
synced 2025-11-20 11:45:51 +00:00
Quit on SIGINT & SIGTERM (added, Docker)
This commit is contained in:
@@ -101,12 +101,15 @@ if (!wss) {
|
|||||||
const server = app.listen(port || 3000)
|
const server = app.listen(port || 3000)
|
||||||
|
|
||||||
// Play nice with Docker etc.
|
// Play nice with Docker etc.
|
||||||
process.on('SIGINT', () => {
|
const quit = () => {
|
||||||
console.log('Shutting down webserver')
|
console.log('Shutting down webserver')
|
||||||
wss.getWss().clients.forEach(client => client.close())
|
wss.getWss().clients.forEach(client => client.close())
|
||||||
server.close()
|
server.close()
|
||||||
wss.getWss().close()
|
wss.getWss().close()
|
||||||
})
|
}
|
||||||
|
|
||||||
|
process.on('SIGINT', quit) // Node
|
||||||
|
process.on('SIGTERM', quit) // Docker
|
||||||
|
|
||||||
console.log('Started Event Socket Service at TCP port', port)
|
console.log('Started Event Socket Service at TCP port', port)
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ connections
|
|||||||
if (!sigintEventHandler) {
|
if (!sigintEventHandler) {
|
||||||
sigintEventHandler = true
|
sigintEventHandler = true
|
||||||
|
|
||||||
process.on('SIGINT', () => {
|
const quit = () => {
|
||||||
connections
|
connections
|
||||||
.map(async c => {
|
.map(async c => {
|
||||||
console.info('Interrupted', c.getState()?.server?.uri)
|
console.info('Interrupted', c.getState()?.server?.uri)
|
||||||
@@ -71,5 +71,8 @@ if (!sigintEventHandler) {
|
|||||||
wtf.dump()
|
wtf.dump()
|
||||||
console.log('-------------------' + `\n`)
|
console.log('-------------------' + `\n`)
|
||||||
}
|
}
|
||||||
})
|
}
|
||||||
|
|
||||||
|
process.on('SIGINT', quit) // Node
|
||||||
|
process.on('SIGTERM', quit) // Docker
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -92,11 +92,14 @@ export {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Play nice with Docker
|
// Play nice with Docker
|
||||||
process.on('SIGINT', () => {
|
const quit = () => {
|
||||||
Object.values(ledgers).forEach(l => {
|
Object.values(ledgers).forEach(l => {
|
||||||
clearTimeout(l?.timeout)
|
clearTimeout(l?.timeout)
|
||||||
l?.ledger_binary_transactions?.resolve(false)
|
l?.ledger_binary_transactions?.resolve(false)
|
||||||
l?.ledger_info?.resolve(false)
|
l?.ledger_info?.resolve(false)
|
||||||
l?.vl?.resolve(false)
|
l?.vl?.resolve(false)
|
||||||
})
|
})
|
||||||
})
|
}
|
||||||
|
|
||||||
|
process.on('SIGINT', quit) // Node
|
||||||
|
process.on('SIGTERM', quit) // Docker
|
||||||
|
|||||||
Reference in New Issue
Block a user