mirror of https://github.com/waku-org/nwaku.git
filter: close stream on every delivered message
This commit is contained in:
parent
7ade979d00
commit
6a6dd7a161
|
@ -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(
|
||||||
|
|
Loading…
Reference in New Issue