mirror of
https://github.com/koush/scrypted.git
synced 2026-03-01 16:52:56 +00:00
server: add runtime kill
This commit is contained in:
@@ -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