Skip to content

Commit

Permalink
upgrade script fix
Browse files Browse the repository at this point in the history
  • Loading branch information
barisusakli committed Nov 14, 2013
1 parent e6bb667 commit 77c2f55
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/upgrade.js
Original file line number Diff line number Diff line change
Expand Up @@ -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') {
Expand All @@ -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.');
Expand Down

0 comments on commit 77c2f55

Please sign in to comment.