From 5a1c25a0dfca12fb3b4836cfb40476290ad638ca Mon Sep 17 00:00:00 2001 From: ansuz Date: Thu, 13 Jun 2019 11:22:20 +0200 Subject: [PATCH] fix a race condition, shutdown the log when you're done --- scripts/evict-inactive.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/evict-inactive.js b/scripts/evict-inactive.js index 51c7eacdc..1ebec6983 100644 --- a/scripts/evict-inactive.js +++ b/scripts/evict-inactive.js @@ -24,7 +24,7 @@ nThen(function (w) { store = _; })); // load the list of pinned files so you know which files // should not be archived or deleted - Pinned.load(function (err, _) { + Pinned.load(w(function (err, _) { if (err) { w.abort(); return void console.error(err); @@ -32,7 +32,7 @@ nThen(function (w) { pins = _; }, { pinPath: config.pinPath, - }); + })); // load the logging module so that you have a record of which // files were archived or deleted at what time @@ -66,7 +66,6 @@ nThen(function (w) { channel: item.channel, }); } - console.log("removed %s from cold storage", item.channel); Log.info('EVICT_ARCHIVED_CHANNEL_REMOVAL', item.channel); removed++; })); @@ -146,5 +145,6 @@ nThen(function (w) { }).nThen(function () { // the store will keep this script running if you don't shut it down store.shutdown(); + Log.shutdown(); });