summaryrefslogtreecommitdiff
path: root/src/server.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/server.c')
-rw-r--r--src/server.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/server.c b/src/server.c
index 6bd19f578..819da25cc 100644
--- a/src/server.c
+++ b/src/server.c
@@ -1230,9 +1230,19 @@ void beforeSleep(struct aeEventLoop *eventLoop) {
/* Unblock all the clients blocked for synchronous replication
* or AOF sync in WAIT. */
- if (listLength(server.clients_waiting_acks))
+ if (listLength(server.clients_waiting_acks)) {
processClientsBlockedInWait();
+ /* If after this cycle we have still clients blocked waiting for
+ * AOF fsync, try to start a new sync cycle. Note that if one is
+ * already in progress, the call does nothing. */
+ if (server.blocked_clients_by_type[BLOCKED_AOF] &&
+ server.aof_state == AOF_ON)
+ {
+ aofStartBackgroundFsync();
+ }
+ }
+
/* Check if there are clients unblocked by modules that implement
* blocking commands. */
moduleHandleBlockedClients();