Disable advertiseQueueLoop completely

It's the main CPU/memory eater
This commit is contained in:
Bulat-Ziganshin 2022-09-08 12:25:13 +03:00
parent 84536744d4
commit 7d6330b938

View File

@ -76,11 +76,9 @@ proc discoveryQueueLoop(b: DiscoveryEngine) {.async.} =
await sleepAsync(b.discoveryLoopSleep)
proc advertiseQueueLoop*(b: DiscoveryEngine) {.async.} =
var x=0
proc onBlock(cid: Cid) {.async.} =
try:
#await b.advertiseQueue.put(cid)
x = x+1
await b.advertiseQueue.put(cid)
except CancelledError as exc:
trace "Cancelling block listing"
raise exc
@ -88,8 +86,7 @@ proc advertiseQueueLoop*(b: DiscoveryEngine) {.async.} =
trace "Exception listing blocks", exc = exc.msg
while b.discEngineRunning:
discard await b.localStore.listBlocks(onBlock)
if x==42: echo x
#discard await b.localStore.listBlocks(onBlock)
trace "About to sleep advertise loop", sleep = b.advertiseLoopSleep
await sleepAsync(b.advertiseLoopSleep)