bin: handle close when interrupted
This commit is contained in:
parent
fcba00ef5b
commit
b18a8a3f13
4
bin/node
4
bin/node
@ -44,6 +44,10 @@ process.on('unhandledRejection', (err, promise) => {
|
||||
throw err;
|
||||
});
|
||||
|
||||
process.on('SIGINT', async () => {
|
||||
await node.close();
|
||||
});
|
||||
|
||||
(async () => {
|
||||
await node.ensure();
|
||||
await node.open();
|
||||
|
||||
@ -33,6 +33,10 @@ process.on('unhandledRejection', (err, promise) => {
|
||||
throw err;
|
||||
});
|
||||
|
||||
process.on('SIGINT', async () => {
|
||||
await node.close();
|
||||
});
|
||||
|
||||
(async () => {
|
||||
await node.ensure();
|
||||
await node.open();
|
||||
|
||||
@ -38,6 +38,10 @@ process.on('unhandledRejection', (err, promise) => {
|
||||
throw err;
|
||||
});
|
||||
|
||||
process.on('SIGINT', async () => {
|
||||
await node.close();
|
||||
});
|
||||
|
||||
(async () => {
|
||||
await node.ensure();
|
||||
await node.open();
|
||||
|
||||
@ -251,9 +251,10 @@ class FullNode extends Node {
|
||||
await this.miner.close();
|
||||
await this.mempool.close();
|
||||
await this.chain.close();
|
||||
await this.handleClose();
|
||||
|
||||
this.logger.info('Node is closed.');
|
||||
|
||||
await this.handleClose();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Loading…
Reference in New Issue
Block a user