Stop the process when expire-channels is done

This commit is contained in:
yflory
2018-02-15 11:33:31 +01:00
parent f004c4d701
commit ef0c08130d
2 changed files with 11 additions and 2 deletions

View File

@@ -418,6 +418,7 @@ module.exports.create = function (
openFileLimit: conf.openFileLimit || 2048,
};
// 0x1ff -> 777
var it;
Fs.mkdir(env.root, 0x1ff, function (err) {
if (err && err.code !== 'EEXIST') {
// TODO: somehow return a nice error
@@ -465,9 +466,12 @@ module.exports.create = function (
if (!isValidChannelId(channelName)) { return void cb(new Error('EINVAL')); }
clearChannel(env, channelName, cb);
},
shutdown: function () {
clearInterval(it);
}
});
});
setInterval(function () {
it = setInterval(function () {
flushUnusedChannels(env, function () { });
}, 5000);
};