Node.js based forum software built for the modern web
added progress bar to ip hash upgrade script
Julian Lam002cde1057e0
diff --git a/src/upgrades/1.10.0/hash_recent_ip_addresses.js b/src/upgrades/1.10.0/hash_recent_ip_addresses.jsindex 14bb0ee60e..9e13db0252 100644--- a/src/upgrades/1.10.0/hash_recent_ip_addresses.js+++ b/src/upgrades/1.10.0/hash_recent_ip_addresses.js@@ -11,6 +11,7 @@ module.exports = {name: 'Hash all IP addresses stored in Recent IPs zset',timestamp: Date.UTC(2017, 5, 22),method: function (callback) {+ const progress = this.progress;var hashed = /[a-f0-9]{32}/;let hash;@@ -18,6 +19,7 @@ module.exports = {async.each(ips, function (set, next) {// Short circuit if already processedif (hashed.test(set.value)) {+ progress.incr();return setImmediate(next);}@@ -26,8 +28,14 @@ module.exports = {async.series([async.apply(db.sortedSetAdd, 'ip:recent', set.score, hash),async.apply(db.sortedSetRemove, 'ip:recent', set.value),- ], next);+ ], function (err) {+ progress.incr();+ next(err);+ });}, next);- }, { withScores: 1 }, callback);+ }, {+ withScores: 1,+ progress: this.progress,+ }, callback);},};