diff --git a/src/replication.c b/src/replication.c index 846f3a26b..1e1be345c 100644 --- a/src/replication.c +++ b/src/replication.c @@ -3068,7 +3068,7 @@ void waitCommand(client *c) { c->bpop.timeout = timeout; c->bpop.reploffset = offset; c->bpop.numreplicas = numreplicas; - listAddNodeTail(server.clients_waiting_acks,c); + listAddNodeHead(server.clients_waiting_acks,c); blockClient(c,BLOCKED_WAIT); /* Make sure that the server will send an ACK request to all the slaves @@ -3103,8 +3103,8 @@ void processClientsWaitingReplicas(void) { * offset and number of replicas, we remember it so the next client * may be unblocked without calling replicationCountAcksByOffset() * if the requested offset / replicas were equal or less. */ - if (last_offset && last_offset > c->bpop.reploffset && - last_numreplicas > c->bpop.numreplicas) + if (last_offset && last_offset >= c->bpop.reploffset && + last_numreplicas >= c->bpop.numreplicas) { unblockClient(c); addReplyLongLong(c,last_numreplicas);