From 344a065d51aa79a96c58c490cf202d5950cb60da Mon Sep 17 00:00:00 2001 From: antirez Date: Mon, 10 Feb 2014 16:00:27 +0100 Subject: [PATCH] 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. --- src/pubsub.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/pubsub.c b/src/pubsub.c index a596dfc9..af075bfe 100644 --- a/src/pubsub.c +++ b/src/pubsub.c @@ -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); }