UNPKG

436 BJavaScriptView Raw
1'use strict';
2function unrefTimeout(fn, timeout) {
3 if (!timeout) {
4 timeout = 1500;
5 }
6 const t = setTimeout(fn, timeout);
7 t.unref();
8}
9const autoExit = (exitCode = 0) => {
10 // fix not auto exit bug after docker operation
11 unrefTimeout(() => {
12 // in order visitor request has been sent out
13 process.exit(exitCode); // eslint-disable-line
14 });
15};
16module.exports = { unrefTimeout, autoExit };