mirror of
https://github.com/koush/scrypted.git
synced 2026-07-01 13:20:36 +01:00
postbeta
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@scrypted/server",
|
||||
"version": "0.98.0",
|
||||
"version": "0.98.1",
|
||||
"description": "",
|
||||
"dependencies": {
|
||||
"@mapbox/node-pre-gyp": "^1.0.11",
|
||||
|
||||
@@ -319,10 +319,6 @@ export class PluginHost {
|
||||
logger.log('e', `${this.pluginName} close`);
|
||||
disconnect();
|
||||
});
|
||||
this.worker.on('disconnect', () => {
|
||||
logger.log('e', `${this.pluginName} disconnected`);
|
||||
disconnect();
|
||||
});
|
||||
this.worker.on('exit', async (code, signal) => {
|
||||
logger.log('e', `${this.pluginName} exited ${code} ${signal}`);
|
||||
disconnect();
|
||||
|
||||
@@ -11,10 +11,9 @@ export abstract class ChildProcessWorker extends EventEmitter implements Runtime
|
||||
}
|
||||
|
||||
setupWorker() {
|
||||
this.worker.on('close', () => this.emit('close'));
|
||||
this.worker.on('disconnect', () => this.emit('disconnect'));
|
||||
this.worker.on('close', (code: number | null, signal: NodeJS.Signals | null) => this.emit('close', code, signal));
|
||||
this.worker.on('disconnect', () => this.emit('error', new Error('disconnect')));
|
||||
this.worker.on('exit', (code, signal) => this.emit('exit', code, signal));
|
||||
this.worker.on('close', () => this.emit('close'));
|
||||
this.worker.on('error', e => this.emit('error', e));
|
||||
}
|
||||
|
||||
|
||||
@@ -20,11 +20,14 @@ export interface RuntimeWorker {
|
||||
kill(): void;
|
||||
|
||||
on(event: 'rpc', listener: (message: any, sendHandle: net.Socket) => void): this;
|
||||
|
||||
on(event: 'error', listener: (err: Error) => void): this;
|
||||
on(event: 'close', listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
|
||||
on(event: 'disconnect', listener: () => void): this;
|
||||
on(event: 'exit', listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
|
||||
on(event: 'close', listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
|
||||
|
||||
once(event: 'error', listener: (err: Error) => void): this;
|
||||
once(event: 'exit', listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
|
||||
once(event: 'close', listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
|
||||
|
||||
send(message: RpcMessage, reject?: (e: Error) => void, serializationContext?: any): void;
|
||||
|
||||
|
||||
@@ -627,7 +627,7 @@ export class ScryptedRuntime extends PluginHttp<HttpPluginData> {
|
||||
}
|
||||
|
||||
setupPluginHostAutoRestart(pluginHost: PluginHost) {
|
||||
pluginHost.worker.once('exit', () => {
|
||||
const restart = () => {
|
||||
if (pluginHost.killed)
|
||||
return;
|
||||
pluginHost.kill();
|
||||
@@ -653,7 +653,10 @@ export class ScryptedRuntime extends PluginHttp<HttpPluginData> {
|
||||
console.error('error restarting plugin', plugin._id, e);
|
||||
}
|
||||
}, timeout);
|
||||
});
|
||||
};
|
||||
pluginHost.worker.once('error', restart);
|
||||
pluginHost.worker.once('exit', restart);
|
||||
pluginHost.worker.once('close', restart);
|
||||
}
|
||||
|
||||
loadPlugin(plugin: Plugin, pluginDebug?: PluginDebug) {
|
||||
|
||||
Reference in New Issue
Block a user