process.nextTick(() => fn().then(resolve).catch(reject));
send(tracer: Tracer, msg: object, opts: object, cb: Function) { tracer && tracer.info('client', __filename, 'send', 'send rpc msg to blackhole'); logger.info('message into blackhole: %j', msg); process.nextTick(function () { cb(tracer, new Error('message was forward to blackhole.')); }); }
stop(force: boolean, cb: () => void) { this.switcher.close(); this.listeningServer.close(); process.nextTick(cb); }
stop(force: boolean, cb: () => void) { for (let type in this.watchers) { this.watchers[type].close(); } this.watchers = {}; process.nextTick(cb); }
let processError = function (socket: ISocket, code: number) { let res = { code: code }; socket.sendForce(Package.encode(Package.TYPE_HANDSHAKE, Buffer.from(JSON.stringify(res)))); process.nextTick(function () { socket.disconnect(); }); }
schedule(reqId: number, route: string, msg: any, recvs: SID[], opts: ScheduleOptions, cb: () => void) { opts = opts || {}; if (opts.type === 'broadcast') { this.doBroadcast( msg, opts.userOptions); } else { this.doBatchPush( msg, recvs); } process.nextTick(function () { utils.invokeCallback(cb); }); }
stop(cb: () => void) { this.monitorConsole.stop(); this.modules = []; process.nextTick(function () { utils.invokeCallback(cb); }); }
connect(tracer: Tracer, cb: (parameter: Error) => void) { tracer && tracer.info('client', __filename, 'connect', 'connect to blackhole'); process.nextTick(function () { cb(new Error('fail to connect to remote server and switch to blackhole.')); }); }
/** * Component lifecycle callback * * @param {Function} cb * @return {Void} */ start(cb: () => void) { this.server.start(); process.nextTick(cb); }
stop(force: boolean, cb: () => void) { this.socket.close(); process.nextTick(cb); }
/** * Remote component lifecycle function * * @param {Boolean} force whether stop the component immediately * @param {Function} cb * @return {Void} */ stop(force: boolean, cb: () => void) { this.remote.stop(force); process.nextTick(cb); }
/** * Stop connector */ stop(force: boolean, cb: () => void) { this.server.close(); process.nextTick(cb); }
/** * Component lifecycle function * * @param {Boolean} force whether stop the component immediately * @param {Function} cb * @return {Void} */ stop(force: boolean, cb: () => void) { this.server.stop(); process.nextTick(cb); }
send(tracer: Tracer, msg: object, opts: object, cb: Function) { tracer && tracer.info('client', __filename, 'send', 'send rpc msg to blackhole'); logger.info('message into blackhole: %j', msg); process.nextTick(function () { cb(tracer, new Error('message was forward to blackhole.')); }); }
connect(tracer: Tracer, cb: (parameter: Error) => void) { tracer && tracer.info('client', __filename, 'connect', 'connect to blackhole'); process.nextTick(function () { cb(new Error('fail to connect to remote server and switch to blackhole.')); }); }