This reapplies https://github.com/vacp2p/nim-libp2p/pull/1015 and is a smaller version of #1028 that focuses on clearing the priority queue at both ends since the completion order of send futures may be reversed.
The PR also introduces a workaround for redundant msg copies when sending encoded messages and ensures that sendMsg always returns a future that can be used for backpressure.
It creates two new metrics libp2p_gossipsub_priority_queue_size and libp2p_gossipsub_non_priority_queue_size that can be enabled with the pubsubpeer_queue_metrics flag. It should be used only locally as it is by peer and create a large amount of data.
This reapplies https://github.com/vacp2p/nim-libp2p/pull/1015 and is a smaller version of #1028 that focuses on clearing the priority queue at both ends since the completion order of send futures may be reversed.
The PR also introduces a workaround for redundant msg copies when sending encoded messages and ensures that
sendMsg
always returns a future that can be used for backpressure.It creates two new metrics
libp2p_gossipsub_priority_queue_size
andlibp2p_gossipsub_non_priority_queue_size
that can be enabled with thepubsubpeer_queue_metrics
flag. It should be used only locally as it is by peer and create a large amount of data.