]> git.saurik.com Git - redis.git/blobdiff - src/redis.c
non blocking slave replication is now more non blocking than the first implementation...
[redis.git] / src / redis.c
index 9312ce4b4ee7fdcdca46be4dbc465da84c8e751f..21a5bd19d9f34da0f4cc5d59bd3fe8f861e41128 100644 (file)
@@ -633,14 +633,10 @@ int serverCron(struct aeEventLoop *eventLoop, long long id, void *clientData) {
         }
     }
 
         }
     }
 
-    /* Check if we should connect to a MASTER */
-    if (server.replstate == REDIS_REPL_CONNECT && !(loops % 10)) {
-        redisLog(REDIS_NOTICE,"Connecting to MASTER...");
-        if (syncWithMaster() == REDIS_OK) {
-            redisLog(REDIS_NOTICE,"MASTER <-> SLAVE sync succeeded");
-            if (server.appendonly) rewriteAppendOnlyFileBackground();
-        }
-    }
+    /* Replication cron function -- used to reconnect to master and
+     * to detect transfer failures. */
+    if (!(loops % 10)) replicationCron();
+
     return 100;
 }
 
     return 100;
 }