mirror of
https://codeberg.org/redict/redict.git
synced 2025-01-22 16:18:28 -05:00
Cluster: properly send ping to nodes not pinged foro too much time.
In commit d728ec6
it was introduced the concept of sending a ping to
every node not receiving a ping since node_timeout/2 seconds.
However the code was located in a place that was not executed because of
a previous conditional causing the loop to re-iterate.
This caused false positives in nodes availability detection.
The current code is still not perfect as a node may be detected to be in
PFAIL state even if it does not reply for just node_timeout/2 seconds
that is not correct. There is a plan to improve this code ASAP.
This commit is contained in:
parent
ace86cfaef
commit
f09b2508f4
@ -1555,11 +1555,6 @@ void clusterCron(void) {
|
|||||||
(REDIS_NODE_MYSELF|REDIS_NODE_NOADDR|REDIS_NODE_HANDSHAKE))
|
(REDIS_NODE_MYSELF|REDIS_NODE_NOADDR|REDIS_NODE_HANDSHAKE))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* Check only if we already sent a ping and did not received
|
|
||||||
* a reply yet. */
|
|
||||||
if (node->ping_sent == 0 ||
|
|
||||||
node->ping_sent <= node->pong_received) continue;
|
|
||||||
|
|
||||||
/* If our ping is older than half the cluster timeout (may happen
|
/* If our ping is older than half the cluster timeout (may happen
|
||||||
* in a cluster with many nodes), send a new ping. */
|
* in a cluster with many nodes), send a new ping. */
|
||||||
if (node->link &&
|
if (node->link &&
|
||||||
@ -1569,6 +1564,11 @@ void clusterCron(void) {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Check only if we already sent a ping and did not received
|
||||||
|
* a reply yet. */
|
||||||
|
if (node->ping_sent == 0 ||
|
||||||
|
node->ping_sent <= node->pong_received) continue;
|
||||||
|
|
||||||
/* If we never received a pong, use the ping time to compute
|
/* If we never received a pong, use the ping time to compute
|
||||||
* the delay. */
|
* the delay. */
|
||||||
if (node->pong_received) {
|
if (node->pong_received) {
|
||||||
|
Loading…
Reference in New Issue
Block a user