Permalink
Browse files

Cluster: don't propagate PUBLISH two times.

PUBLISH both published messages via Cluster bus and replication when
cluster was enabled, resulting in duplicated message in the slave.
  • Loading branch information...
antirez committed Feb 10, 2014
1 parent 7bf7b73 commit 344a065d51aa79a96c58c490cf202d5950cb60da
Showing with 4 additions and 2 deletions.
  1. +4 −2 src/pubsub.c
View
@@ -306,8 +306,10 @@ void punsubscribeCommand(redisClient *c) {
void publishCommand(redisClient *c) {
int receivers = pubsubPublishMessage(c->argv[1],c->argv[2]);
- if (server.cluster_enabled) clusterPropagatePublish(c->argv[1],c->argv[2]);
- forceCommandPropagation(c,REDIS_PROPAGATE_REPL);
+ if (server.cluster_enabled)
+ clusterPropagatePublish(c->argv[1],c->argv[2]);
+ else
+ forceCommandPropagation(c,REDIS_PROPAGATE_REPL);
addReplyLongLong(c,receivers);
}

0 comments on commit 344a065

Please sign in to comment.