diff --git a/src/pubsub.c b/src/pubsub.c index 1a151b96c..afaf0832f 100644 --- a/src/pubsub.c +++ b/src/pubsub.c @@ -374,9 +374,8 @@ void pubsubShardUnsubscribeAllChannelsInSlot(unsigned int slot) { while ((de = dictNext(di)) != NULL) { robj *channel = dictGetKey(de); dict *clients = dictGetVal(de); - if (dictSize(clients) == 0) goto cleanup; /* For each client subscribed to the channel, unsubscribe it. */ - dictIterator *iter = dictGetSafeIterator(clients); + dictIterator *iter = dictGetIterator(clients); dictEntry *entry; while ((entry = dictNext(iter)) != NULL) { client *c = dictGetKey(entry); @@ -390,7 +389,6 @@ void pubsubShardUnsubscribeAllChannelsInSlot(unsigned int slot) { } } dictReleaseIterator(iter); -cleanup: server.shard_channel_count--; dictDelete(d, channel); } @@ -529,7 +527,7 @@ int pubsubPublishMessageInternal(robj *channel, robj *message, pubsubtype type) if (de) { dict *clients = dictGetVal(de); dictEntry *entry; - dictIterator *iter = dictGetSafeIterator(clients); + dictIterator *iter = dictGetIterator(clients); while ((entry = dictNext(iter)) != NULL) { client *c = dictGetKey(entry); addReplyPubsubMessage(c,channel,message,*type.messageBulk); @@ -557,7 +555,7 @@ int pubsubPublishMessageInternal(robj *channel, robj *message, pubsubtype type) sdslen(channel->ptr),0)) continue; dictEntry *entry; - dictIterator *iter = dictGetSafeIterator(clients); + dictIterator *iter = dictGetIterator(clients); while ((entry = dictNext(iter)) != NULL) { client *c = dictGetKey(entry); addReplyPubsubPatMessage(c,pattern,channel,message);