From 77c2f551d3897746e3bdfae37b552aeb232c6bef Mon Sep 17 00:00:00 2001 From: Baris Soner Usakli Date: Wed, 13 Nov 2013 20:03:44 -0500 Subject: [PATCH] upgrade script fix --- src/upgrade.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/upgrade.js b/src/upgrade.js index 0e77918b86..67b349f226 100644 --- a/src/upgrade.js +++ b/src/upgrade.js @@ -88,7 +88,6 @@ Upgrade.upgrade = function() { thisSchemaDate = new Date(2013, 9, 23).getTime(); if (schemaDate < thisSchemaDate) { RDB.keys('notifications:*', function(err, keys) { - var multi = RDB.multi(); keys = keys.filter(function(key) { if (key === 'notifications:next_nid') { @@ -101,7 +100,13 @@ Upgrade.upgrade = function() { }); winston.info('[2013/10/23] Adding existing notifications to set'); - RDB.sadd('notifications', keys, next); + + if(keys && Array.isArray(keys)) { + async.each(keys, function(key, cb) { + RDB.sadd('notifications', key, cb); + }, next); + } else next(); + }); } else { winston.info('[2013/10/23] Updates to Notifications skipped.');