提交 5b4020fb 编写于 作者: A antirez

Cluster: swap two code blocks to have a more obvious flow.

上级 4beaaff8
......@@ -1964,14 +1964,6 @@ void clusterHandleSlaveFailover(void) {
int needed_quorum = (server.cluster->size / 2) + 1;
int j;
/* Set data_age to the number of seconds we are disconnected from
* the master. */
if (server.repl_state == REDIS_REPL_CONNECTED) {
data_age = (server.unixtime - server.master->lastinteraction) * 1000;
} else {
data_age = (server.unixtime - server.repl_down_since) * 1000;
}
/* Pre conditions to run the function:
* 1) We are a slave.
* 2) Our master is flagged as FAIL.
......@@ -1981,6 +1973,14 @@ void clusterHandleSlaveFailover(void) {
!nodeFailed(myself->slaveof) ||
myself->slaveof->numslots == 0) return;
/* Set data_age to the number of seconds we are disconnected from
* the master. */
if (server.repl_state == REDIS_REPL_CONNECTED) {
data_age = (server.unixtime - server.master->lastinteraction) * 1000;
} else {
data_age = (server.unixtime - server.repl_down_since) * 1000;
}
/* Remove the node timeout from the data age as it is fine that we are
* disconnected from our master at least for the time it was down to be
* flagged as FAIL, that's the baseline. */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册