filter: close stream on every delivered message

This commit is contained in:
Ivan Folgueira Bande 2024-12-03 22:23:28 +01:00
parent 7ade979d00
commit 6a6dd7a161
No known key found for this signature in database
GPG Key ID: 3C117481F89E24A7
1 changed files with 5 additions and 0 deletions

View File

@ -176,6 +176,11 @@ proc pushToPeer(wf: WakuFilter, peer: PeerId, buffer: seq[byte]) {.async.} =
error "no connection to peer", peerId = shortLog(peer) error "no connection to peer", peerId = shortLog(peer)
return return
defer:
## TODO we need to perform a better resource management and avoid
## creating a new stream and closing it for every single msg
await conn.get().close()
await conn.get().writeLp(buffer) await conn.get().writeLp(buffer)
debug "published successful", peerId = shortLog(peer) debug "published successful", peerId = shortLog(peer)
waku_service_network_bytes.inc( waku_service_network_bytes.inc(