From e5f7eed8eccea49eefe9fc75fd072dda22d8c223 Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Wed, 19 Apr 2017 12:18:00 -0400 Subject: [PATCH] adding progress bar to session deletion upgrade script --- src/upgrades/1.4.6/delete_sessions.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/upgrades/1.4.6/delete_sessions.js b/src/upgrades/1.4.6/delete_sessions.js index 0a78f11206..fd4004ec9e 100644 --- a/src/upgrades/1.4.6/delete_sessions.js +++ b/src/upgrades/1.4.6/delete_sessions.js @@ -11,6 +11,7 @@ module.exports = { method: function (callback) { var configJSON = require.main.require('./config.json'); var isRedisSessionStore = configJSON.hasOwnProperty('redis'); + var progress = this.progress; async.waterfall([ function (next) { @@ -22,7 +23,10 @@ module.exports = { client.keys('sess:*', next); }, function (sessionKeys, next) { + progress.total = sessionKeys.length; + async.eachSeries(sessionKeys, function (key, next) { + progress.incr(); client.del(key, next); }, next); },