add ValueGetFrom count for naive getValue

Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
This commit is contained in:
Csaba Kiraly 2023-06-19 12:12:33 +02:00
parent 7c7cd29df1
commit bca26eb059
No known key found for this signature in database
GPG Key ID: 0FE274EE8C95166E
1 changed files with 2 additions and 1 deletions

View File

@ -130,6 +130,7 @@ const
MaxProvidersEntries* = 1_000_000 # one million records
MaxProvidersPerEntry* = 20 # providers per entry
ValueReplication = 5 # store a value in this many nodes
ValueGetFrom = 5 # try to get value from this many nodes (naive lookup based implementation)
## call
func shortLog*(record: SignedPeerRecord): string =
@ -904,7 +905,7 @@ proc getValue*(
let nodesNearby = await d.lookup(cId)
trace "nearby:", nodesNearby
var providersFut: seq[Future[DiscResult[ValueMessage]]]
for n in nodesNearby:
for n in nodesNearby[0 .. ValueGetFrom]:
if n != d.localNode:
providersFut.add(d.sendGetValue(n, cId))