1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-06 02:15:48 +03:00

Use process.nextTick to uncork

This commit is contained in:
Ruben Bridgewater
2016-04-29 06:11:12 +02:00
parent a1755b91fb
commit 340cddb6d1
4 changed files with 19 additions and 11 deletions

View File

@@ -491,18 +491,19 @@ describe('publish/subscribe', function () {
});
sub2.on('ready', function () {
sub2.batch().psubscribe('*', helper.isString('*')).exec();
sub2.subscribe('/foo');
sub2.subscribe('/foo', function () {
pub.pubsub('numsub', '/foo', function (err, res) {
assert.deepEqual(res, ['/foo', 2]);
});
// sub2 is counted twice as it subscribed with psubscribe and subscribe
pub.publish('/foo', 'hello world', helper.isNumber(3));
});
sub2.on('pmessage', function (pattern, channel, message) {
assert.strictEqual(pattern.inspect(), new Buffer('*').inspect());
assert.strictEqual(channel.inspect(), new Buffer('/foo').inspect());
assert.strictEqual(message.inspect(), new Buffer('hello world').inspect());
sub2.quit(done);
});
pub.pubsub('numsub', '/foo', function (err, res) {
assert.deepEqual(res, ['/foo', 2]);
});
// sub2 is counted twice as it subscribed with psubscribe and subscribe
pub.publish('/foo', 'hello world', helper.isNumber(3));
});
});