diff --git a/lib/persistence/redis.js b/lib/persistence/redis.js index 607e4b3..5a298a6 100644 --- a/lib/persistence/redis.js +++ b/lib/persistence/redis.js @@ -98,6 +98,8 @@ function RedisPersistence(options, callback) { if (!result || typeof subs !== 'object') { if (!retried) { setTimeout(fetchAndUpdateLocalSub.bind(null, key, unsubs, true, cb), 500); + } else { + cb && cb(); } return; } @@ -132,24 +134,43 @@ function RedisPersistence(options, callback) { return; } var subsStream = that._client.scanStream({ - match: "client:sub:*" + match: "client:sub:*", + count: 25000 }); - var keys = []; + var pipeline = that._client.pipeline(); + var total = 0; + var done = null; + subsStream.on('data', function(moreKeys){ - for( var i=0; i