diff --git a/waku/waku_filter_v2/protocol.nim b/waku/waku_filter_v2/protocol.nim index c6e843fc0..30a450bec 100644 --- a/waku/waku_filter_v2/protocol.nim +++ b/waku/waku_filter_v2/protocol.nim @@ -176,6 +176,11 @@ proc pushToPeer(wf: WakuFilter, peer: PeerId, buffer: seq[byte]) {.async.} = error "no connection to peer", peerId = shortLog(peer) 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) debug "published successful", peerId = shortLog(peer) waku_service_network_bytes.inc(