From b177d198b3c183c4e5eaf4ee5e382e94e660967d Mon Sep 17 00:00:00 2001 From: Simo Kinnunen Date: Tue, 25 Feb 2014 21:01:21 +0900 Subject: [PATCH] Don't try to be clever with cleanup. It's too tricky to get it right. --- lib/roles/reaper.js | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/lib/roles/reaper.js b/lib/roles/reaper.js index 11cdfead..1f0acf25 100644 --- a/lib/roles/reaper.js +++ b/lib/roles/reaper.js @@ -56,18 +56,14 @@ module.exports = function(options) { quit.resolve() }) - quit.promise.finally(function() { - clearInterval(timer) - dbapi.close() - .timeout(10000) - .then(function() { - log.info('Quit after cleanup') - }) - .catch(Promise.TimeoutError, function() { - log.error('Cleanup operation timed out, closing unsafely') - process.exit(1) - }) - }) + quit.promise + .then(function() { + process.exit(0) + }) + .catch(function(err) { + log.fatal('Error caused quit: ', err.stack) + process.exit(1) + }) log.info('Reaping devices with no heartbeat') }