From be76c56b519a0390a7d7b0535685cdaa8254388e Mon Sep 17 00:00:00 2001 From: Hyungjin Kim Date: Mon, 30 Jan 2017 20:00:04 +0900 Subject: [PATCH] Consider sub by pattern when clear subscribed flag --- async.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/async.c b/async.c index 3654580..e3f5ac3 100644 --- a/async.c +++ b/async.c @@ -407,7 +407,9 @@ static int __redisGetSubscribeCallback(redisAsyncContext *ac, redisReply *reply, assert(reply->element[2]->type == REDIS_REPLY_INTEGER); /* Unset subscribed flag only when no pipelined pending subscribe. */ - if (reply->element[2]->integer == 0 && dictSize(callbacks) == 0) + if (reply->element[2]->integer == 0 + && dictSize(ac->sub.channels) == 0 + && dictSize(ac->sub.patterns) == 0) c->flags &= ~REDIS_SUBSCRIBED; } }