Revalidate loop fix (#60)
* Sets lower limit in revalidation loop timeout. * Moves up RevalidateMin
This commit is contained in:
parent
4375b92298
commit
348cb0f1ad
|
@ -121,7 +121,8 @@ const
|
|||
MaxNodesPerMessage = 3 ## Maximum amount of SPRs per individual Nodes message
|
||||
RefreshInterval = 5.minutes ## Interval of launching a random query to
|
||||
## refresh the routing table.
|
||||
RevalidateMax = 10000 ## Revalidation of a peer is done between 0 and this
|
||||
RevalidateMin = 5000
|
||||
RevalidateMax = 10000 ## Revalidation of a peer is done between min and max milliseconds.
|
||||
## value in milliseconds
|
||||
IpMajorityInterval = 5.minutes ## Interval for checking the latest IP:Port
|
||||
## majority and updating this when SPR auto update is set.
|
||||
|
@ -937,7 +938,8 @@ proc revalidateLoop(d: Protocol) {.async.} =
|
|||
## message.
|
||||
try:
|
||||
while true:
|
||||
await sleepAsync(milliseconds(d.rng[].rand(RevalidateMax)))
|
||||
let revalidateTimeout = RevalidateMin + d.rng[].rand(RevalidateMax - RevalidateMin)
|
||||
await sleepAsync(milliseconds(revalidateTimeout))
|
||||
let n = d.routingTable.nodeToRevalidate()
|
||||
if not n.isNil:
|
||||
traceAsyncErrors d.revalidateNode(n)
|
||||
|
|
Loading…
Reference in New Issue