Compare commits

...

2 Commits

1 changed files with 10 additions and 7 deletions

View File

@ -2,8 +2,8 @@ import { start as startRpc } from "./modules/rpc.js";
import { start as startRelay } from "./modules/relay.js";
import { start as startApp } from "./modules/app";
import config from "./config.js";
import { loadPlugins } from "./modules/plugin.js";
import { start as startSwarm } from "./modules/swarm.js";
import { getPluginAPI, loadPlugins } from "./modules/plugin.js";
import { start as startSwarm, get as getSwarm } from "./modules/swarm.js";
import * as bip39 from "@scure/bip39";
import { wordlist } from "@scure/bip39/wordlists/english";
@ -26,9 +26,12 @@ boot();
process.on("uncaughtException", function (err) {
console.log(`Caught exception: ${err.message} ${err.stack}`);
});
process.on("SIGINT", function () {
async function shutdown() {
await getPluginAPI().emitAsync("core.shutdown");
await getSwarm().destroy();
process.exit();
});
process.on("SIGTERM", function () {
process.exit();
});
}
process.on("SIGINT", shutdown);
process.on("SIGTERM", shutdown);