Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
0c9f60a6
Commit
0c9f60a6
authored
Oct 11, 2013
by
antirez
Browse files
Cluster: there is a lower limit for the handshake timeout.
parent
1447d28c
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/cluster.c
View file @
0c9f60a6
...
@@ -1743,9 +1743,17 @@ void clusterCron(void) {
...
@@ -1743,9 +1743,17 @@ void clusterCron(void) {
mstime_t min_pong = 0, now = mstime();
mstime_t min_pong = 0, now = mstime();
clusterNode *min_pong_node = NULL;
clusterNode *min_pong_node = NULL;
static unsigned long long iteration = 0;
static unsigned long long iteration = 0;
mstime_t handshake_timeout;
iteration++; /* Number of times this function was called so far. */
iteration++; /* Number of times this function was called so far. */
/* The handshake timeout is the time after which an handshake node that was
* not turned into a normal node is removed from the nodes. Usually it is
* just the NODE_TIMEOUT value, but when NODE_TIMEOUT is too small we use
* the value of 1 second. */
handshake_timeout = server.cluster_node_timeout;
if (handshake_timeout < 1000) handshake_timeout = 1000;
/* Check if we have disconnected nodes and re-establish the connection. */
/* Check if we have disconnected nodes and re-establish the connection. */
di = dictGetSafeIterator(server.cluster->nodes);
di = dictGetSafeIterator(server.cluster->nodes);
while((de = dictNext(di)) != NULL) {
while((de = dictNext(di)) != NULL) {
...
@@ -1756,7 +1764,7 @@ void clusterCron(void) {
...
@@ -1756,7 +1764,7 @@ void clusterCron(void) {
/* A Node in HANDSHAKE state has a limited lifespan equal to the
/* A Node in HANDSHAKE state has a limited lifespan equal to the
* configured node timeout. */
* configured node timeout. */
if (node->flags & REDIS_NODE_HANDSHAKE &&
if (node->flags & REDIS_NODE_HANDSHAKE &&
now - node->ctime >
server.cluster_nod
e_timeout)
now - node->ctime >
handshak
e_timeout)
{
{
freeClusterNode(node);
freeClusterNode(node);
continue;
continue;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment