function resume(stream, state) { if (!state.resumeScheduled) { state.resumeScheduled = true; process.nextTick(resume_, stream, state); } }
destroy (err) { if (this.destroyed) return this.destroyed = true if (err) { this.emit('error', err) } process.nextTick(() => { this.emit('close') }) }
function maybeLookup (hostname, opts, callback) { if (hostname === ip) { process.nextTick(callback, null, ip) } else { lookup(hostname, opts, callback) } }
// Don't emit readable right away in sync mode, because this can trigger // another read() call => stack overflow. This way, it might trigger // a nextTick recursion warning, but that's not so bad. function emitReadable(stream) { var state = stream._readableState; state.needReadable = false; if (!state.emittedReadable) { debug('emitReadable', state.flowing); state.emittedReadable = true; if (state.sync) process.nextTick(emitReadable_, stream); else emitReadable_(stream); } }
register(container) { process.nextTick(() => { const settings = getSettings(container); const database = container.get('database'); const apiServer = container.get('api-server'); configurePassport(database, settings); const plugin = passport.initialize(); apiServer.plugins.push(plugin); const logger = container.get('logger'); container.register('auth', { ensureAuthenticated }); const router = apiServer.newRouter(); mountUser(router, container); apiServer.routers.push(router); logger.info('API Auth JWT plugin mounted'); }); }
function callWithReq(method, path, req, srcContainer) { return new Promise((resolve) => { const container = srcContainer || bootstrap(); const apiAuthJwt = new ApiAuthJwt(); apiAuthJwt.register(container); process.nextTick(() => { const apiServer = container.get('api-server'); const res = new ResMock(); const callback = (err, result) => { resolve({ container, res, err, result, }); }; res.callback = callback; apiServer.call(method, path, req, res, callback); }); }); }
function endReadable(stream) { var state = stream._readableState; if (!state.endEmitted) { state.ended = true; process.nextTick(endReadableNT, state, stream); } }
t.is(test.destroyed, false) process.nextTick(function () { t.is(test.destroyed, true)
// at this point, the user has presumably seen the 'readable' event, // and called read() to consume some data. that may have triggered // in turn another _read(n) call, in which case reading = true if // it's in progress. // However, if we're not ended, or reading, and the length < hwm, // then go ahead and try to read some more preemptively. function maybeReadMore(stream, state) { if (!state.readingMore) { state.readingMore = true; process.nextTick(maybeReadMore_, stream, state); } }
err.statusCode = res.statusCode; socket.destroy(); process.nextTick(function() { req.emit('error', err); });
[kOnReady] (fn) { if (this[kReady]) process.nextTick(fn) else this.once(kReady, fn) }
return process.nextTick( callback, new Error('expected first cli argument to be clinic')
err.statusCode = _res.statusCode; svrSock.destroy(); process.nextTick(function() { client.emit('error', err); });
process.nextTick(function() { parseRules(); });
createSession (callback) { process.nextTick(callback, new MockSession()) }