Пример #1
0
 /* PROCESS MANAGEMENT */
 async shutdown () {
   if (!this.proc) return;
   
   log.debug('Starting shutdown.');
   let wasTerminated = false;
   // monitoring process termination
   let termDelay = cancellableDelay(this.termTimeout);
   let termPromise = termDelay.catch(B.CancellationError, () => {});
   this.setExitListener(() => {
     this.proc = null;
     wasTerminated = true;
     termDelay.cancel();
     this.onShutdownDeferred.resolve();
   });
   log.debug('Sending sigterm to instruments');
   this.proc.kill('SIGTERM');
   await termPromise;
   if (!wasTerminated) {
     log.warn(`Instruments did not terminate after ${this.termTimeout / 1000} seconds!`);
     log.debug('Sending SIGKILL');
     this.proc.kill('SIGKILL');
     if (_.isFunction(this.exitListener)) {
       this.exitListener();
     }
   }
 }
Пример #2
0
 addSocketConnectTimer (delay, type, doAction) {
   let socketConnectDelay = cancellableDelay(delay);
   socketConnectDelay.then(() => {
     log.warn(`Instruments socket client never checked in; timing out (${type})`);
     return doAction();
   }).catch(B.CancellationError, () => {}).done();
   this.socketConnectDelays.push(socketConnectDelay);
 }
Пример #3
0
 addSocketConnectTimer (delay, type, doAction) {
   let socketConnectDelay = cancellableDelay(delay);
   socketConnectDelay.then(() => {
     log.warn(`Instruments socket client never checked in; timing out (${type})`);
     this.setExitListener(() => {
       this.proc = null;
       this.launchResultDeferred.reject(new Error(ERR_NEVER_CHECKED_IN));
     });
     return doAction();
   }).catch(B.CancellationError, () => {}).done();
   this.socketConnectDelays.push(socketConnectDelay);
 }