From d6ab801ab2c538cbe6dbb01d0fada4a18d317d2d Mon Sep 17 00:00:00 2001 From: Binbin Date: Thu, 8 Feb 2024 23:00:30 +0800 Subject: [PATCH] handle aof_flush_postponed_start as well --- src/aof.c | 4 ++-- src/server.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/aof.c b/src/aof.c index ac6cf64143c..7f9abce9cce 100644 --- a/src/aof.c +++ b/src/aof.c @@ -1109,9 +1109,9 @@ void flushAppendOnlyFile(int force) { if (server.aof_flush_postponed_start == 0) { /* No previous write postponing, remember that we are * postponing the flush and return. */ - server.aof_flush_postponed_start = server.unixtime; + server.aof_flush_postponed_start = server.mstime; return; - } else if (server.unixtime - server.aof_flush_postponed_start < 2) { + } else if (server.mstime - server.aof_flush_postponed_start < 2000) { /* We were already waiting for fsync to finish, but for less * than two seconds this is still ok. Postpone again. */ return; diff --git a/src/server.h b/src/server.h index b23c0ae2508..c43acc18c4a 100644 --- a/src/server.h +++ b/src/server.h @@ -1778,7 +1778,7 @@ struct redisServer { sds aof_buf; /* AOF buffer, written before entering the event loop */ int aof_fd; /* File descriptor of currently selected AOF file */ int aof_selected_db; /* Currently selected DB in AOF */ - time_t aof_flush_postponed_start; /* UNIX time of postponed AOF flush */ + time_t aof_flush_postponed_start; /* mstime of postponed AOF flush */ time_t aof_last_fsync; /* mstime of last fsync() */ time_t aof_rewrite_time_last; /* Time used by last AOF rewrite run. */ time_t aof_rewrite_time_start; /* Current AOF rewrite start time. */