mirror of
https://github.com/logos-storage/logos-storage-nim-dht.git
synced 2026-01-04 06:23:05 +00:00
upload to DHT in parallel
Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
This commit is contained in:
parent
2a8c7e78f9
commit
479d6405b6
10
das/das.nim
10
das/das.nim
@ -90,6 +90,7 @@ when isMainModule:
|
||||
blocksize = 16
|
||||
segmentsize = 10
|
||||
samplesize = 3
|
||||
upload_timeout = 5.seconds
|
||||
sampling_timeout = 5.seconds
|
||||
|
||||
var
|
||||
@ -112,6 +113,9 @@ when isMainModule:
|
||||
await sleepAsync(chronos.milliseconds(delay_init))
|
||||
|
||||
# generate block and push data
|
||||
info "starting upload to DHT"
|
||||
let startTime = Moment.now()
|
||||
var futs = newSeq[Future[seq[Node]]]()
|
||||
for s in 0 ..< blocksize:
|
||||
let
|
||||
segment = segmentData(s, segmentsize)
|
||||
@ -119,8 +123,10 @@ when isMainModule:
|
||||
|
||||
segmentIDs[s] = key
|
||||
|
||||
let addedTo = await node0.addValue(key, segment)
|
||||
debug "Value added to: ", addedTo
|
||||
futs.add(node0.addValue(key, segment))
|
||||
|
||||
let pass = await allFutures(futs).withTimeout(upload_timeout)
|
||||
info "uploaded to DHT", by = 0, pass, time = Moment.now() - startTime
|
||||
|
||||
# sample
|
||||
for n in 1 ..< nodecount:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user