mirror of
https://github.com/koush/scrypted.git
synced 2026-05-29 16:00:27 +01:00
server: add runtime kill
This commit is contained in:
4
server/package-lock.json
generated
4
server/package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "@scrypted/server",
|
||||
"version": "0.7.97",
|
||||
"version": "0.8.0",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@scrypted/server",
|
||||
"version": "0.7.97",
|
||||
"version": "0.8.0",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"@mapbox/node-pre-gyp": "^1.0.10",
|
||||
|
||||
@@ -827,18 +827,22 @@ export class ScryptedRuntime extends PluginHttp<HttpPluginData> {
|
||||
return ret;
|
||||
}
|
||||
|
||||
killall() {
|
||||
kill() {
|
||||
for (const host of Object.values(this.plugins)) {
|
||||
host?.kill();
|
||||
}
|
||||
}
|
||||
|
||||
exit() {
|
||||
this.kill();
|
||||
process.exit();
|
||||
}
|
||||
|
||||
async start() {
|
||||
// catch ctrl-c
|
||||
process.on('SIGINT', () => this.killall());
|
||||
process.on('SIGINT', () => this.exit());
|
||||
// catch kill
|
||||
process.on('SIGTERM', () => this.killall());
|
||||
process.on('SIGTERM', () => this.exit());
|
||||
|
||||
for await (const pluginDevice of this.datastore.getAll(PluginDevice)) {
|
||||
// this may happen due to race condition around deletion/update. investigate.
|
||||
|
||||
Reference in New Issue
Block a user