Compare commits
2 Commits
d569c5fd8b
...
831612bc77
Author | SHA1 | Date |
---|---|---|
Derrick Hammer | 831612bc77 | |
Derrick Hammer | 6a41daff62 |
17
src/index.ts
17
src/index.ts
|
@ -2,8 +2,8 @@ import { start as startRpc } from "./modules/rpc.js";
|
||||||
import { start as startRelay } from "./modules/relay.js";
|
import { start as startRelay } from "./modules/relay.js";
|
||||||
import { start as startApp } from "./modules/app";
|
import { start as startApp } from "./modules/app";
|
||||||
import config from "./config.js";
|
import config from "./config.js";
|
||||||
import { loadPlugins } from "./modules/plugin.js";
|
import { getPluginAPI, loadPlugins } from "./modules/plugin.js";
|
||||||
import { start as startSwarm } from "./modules/swarm.js";
|
import { start as startSwarm, get as getSwarm } from "./modules/swarm.js";
|
||||||
import * as bip39 from "@scure/bip39";
|
import * as bip39 from "@scure/bip39";
|
||||||
import { wordlist } from "@scure/bip39/wordlists/english";
|
import { wordlist } from "@scure/bip39/wordlists/english";
|
||||||
|
|
||||||
|
@ -26,9 +26,12 @@ boot();
|
||||||
process.on("uncaughtException", function (err) {
|
process.on("uncaughtException", function (err) {
|
||||||
console.log(`Caught exception: ${err.message} ${err.stack}`);
|
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.exit();
|
||||||
});
|
}
|
||||||
process.on("SIGTERM", function () {
|
|
||||||
process.exit();
|
process.on("SIGINT", shutdown);
|
||||||
});
|
process.on("SIGTERM", shutdown);
|
||||||
|
|
Loading…
Reference in New Issue