mirror of
https://github.com/codex-storage/nim-codex.git
synced 2025-02-17 23:36:33 +00:00
Disable only advertiseQueue.put
when listBlocks isn't called by advertiseQueueLoop, we have 0% of CPU usage. so 1) idle node burns cpu exclusively inside advertiseQueueLoop 2) idle node memleaks exclusively via advertiseQueue.put
This commit is contained in:
parent
38ffb990e8
commit
84536744d4
@ -76,9 +76,11 @@ 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)
|
||||
#await b.advertiseQueue.put(cid)
|
||||
x = x+1
|
||||
except CancelledError as exc:
|
||||
trace "Cancelling block listing"
|
||||
raise exc
|
||||
@ -87,6 +89,7 @@ proc advertiseQueueLoop*(b: DiscoveryEngine) {.async.} =
|
||||
|
||||
while b.discEngineRunning:
|
||||
discard await b.localStore.listBlocks(onBlock)
|
||||
if x==42: echo x
|
||||
|
||||
trace "About to sleep advertise loop", sleep = b.advertiseLoopSleep
|
||||
await sleepAsync(b.advertiseLoopSleep)
|
||||
|
Loading…
x
Reference in New Issue
Block a user