summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2015-03-20 09:46:10 +0100
committerantirez <antirez@gmail.com>2015-03-20 10:06:07 +0100
commit585f68ac351f5d55675870fe4127a72923e6d145 (patch)
tree21a03d25b9e4ce69dda9956daa1c0f1147d839ea
parentd8236ea262f947ac27f5e2e324511796609a1752 (diff)
downloadredis-585f68ac351f5d55675870fe4127a72923e6d145.tar.gz
Cluster: move clusterBeforeSleep() call before unblocked clients processing.
Related to issue #2288.
-rw-r--r--src/redis.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/redis.c b/src/redis.c
index 4bf5d1b58..3ffc62d02 100644
--- a/src/redis.c
+++ b/src/redis.c
@@ -1257,6 +1257,12 @@ int serverCron(struct aeEventLoop *eventLoop, long long id, void *clientData) {
void beforeSleep(struct aeEventLoop *eventLoop) {
REDIS_NOTUSED(eventLoop);
+ /* Call the Redis Cluster before sleep function. Note that this function
+ * may change the state of Redis Cluster (frok ok to fail or vice versa),
+ * so it's a good idea to call it before serving the unblocked clients
+ * later in this function. */
+ if (server.cluster_enabled) clusterBeforeSleep();
+
/* Run a fast expire cycle (the called function will return
* ASAP if a fast cycle is not needed). */
if (server.active_expire_enabled && server.masterhost == NULL)
@@ -1288,9 +1294,6 @@ void beforeSleep(struct aeEventLoop *eventLoop) {
/* Write the AOF buffer on disk */
flushAppendOnlyFile(0);
-
- /* Call the Redis Cluster before sleep function. */
- if (server.cluster_enabled) clusterBeforeSleep();
}
/* =========================== Server initialization ======================== */