diff --git a/src/replication.c b/src/replication.c index 745d317ca..a288478ff 100644 --- a/src/replication.c +++ b/src/replication.c @@ -826,18 +826,16 @@ void syncCommand(client *c) { /* CASE 3: There is no BGSAVE is progress. */ } else { - if (server.repl_diskless_sync && (c->slave_capa & SLAVE_CAPA_EOF)) { + if (server.repl_diskless_sync && (c->slave_capa & SLAVE_CAPA_EOF) && + server.repl_diskless_sync_delay) + { /* Diskless replication RDB child is created inside * replicationCron() since we want to delay its start a * few seconds to wait for more slaves to arrive. */ - if (server.repl_diskless_sync_delay) - serverLog(LL_NOTICE,"Delay next BGSAVE for diskless SYNC"); - else - startBgsaveForReplication(c->slave_capa); + serverLog(LL_NOTICE,"Delay next BGSAVE for diskless SYNC"); } else { - /* Target is disk (or the slave is not capable of supporting - * diskless replication) and we don't have a BGSAVE in progress, - * let's start one. */ + /* We don't have a BGSAVE in progress, let's start one. Diskless + * or disk-based mode is determined by replica's capacity. */ if (!hasActiveChildProcess()) { startBgsaveForReplication(c->slave_capa); } else {