mirror of
https://github.com/logos-storage/logos-storage-nim-dht.git
synced 2026-01-08 00:13:07 +00:00
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
|
MaxNodesPerMessage = 3 ## Maximum amount of SPRs per individual Nodes message
|
||||||
RefreshInterval = 5.minutes ## Interval of launching a random query to
|
RefreshInterval = 5.minutes ## Interval of launching a random query to
|
||||||
## refresh the routing table.
|
## 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
|
## value in milliseconds
|
||||||
IpMajorityInterval = 5.minutes ## Interval for checking the latest IP:Port
|
IpMajorityInterval = 5.minutes ## Interval for checking the latest IP:Port
|
||||||
## majority and updating this when SPR auto update is set.
|
## majority and updating this when SPR auto update is set.
|
||||||
@ -937,7 +938,8 @@ proc revalidateLoop(d: Protocol) {.async.} =
|
|||||||
## message.
|
## message.
|
||||||
try:
|
try:
|
||||||
while true:
|
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()
|
let n = d.routingTable.nodeToRevalidate()
|
||||||
if not n.isNil:
|
if not n.isNil:
|
||||||
traceAsyncErrors d.revalidateNode(n)
|
traceAsyncErrors d.revalidateNode(n)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user