mirror of
https://github.com/fluencelabs/redis
synced 2025-05-10 01:37:26 +00:00
Cluster: swap two code blocks to have a more obvious flow.
This commit is contained in:
parent
4beaaff8ea
commit
5b4020fb42
@ -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. */
|
||||
|
Loading…
x
Reference in New Issue
Block a user