add SIGINT handler to fix #32

This commit is contained in:
Ewout Stortenbeker 2022-11-22 22:01:54 +01:00
parent fd49e57ec8
commit 88140478c1

View file

@ -342,6 +342,15 @@ export class AceBaseClient extends AceBaseBase {
this.emit('ready');
};
if (typeof process !== 'undefined') {
// Enable graceful process exits, fixes #32
process.on('SIGINT', () => {
if (this.connected) {
this.disconnect(); // Should be enough to exit process
}
});
}
this.api = new WebApi(settings.dbname, {
network: settings.network,
sync: settings.sync,