mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 12:17:58 +00:00
Fix notifications sometimes not being sent (#7594)
* Fix notifications sometimes not being sent * Add comment
This commit is contained in:
@@ -971,6 +971,16 @@ impl ProtocolsHandler for NotifsHandler {
|
||||
if let Some(pos) = self.out_protocols.iter().position(|(n, _)| *n == protocol_name) {
|
||||
if let Some(substream) = out_substreams[pos].as_mut() {
|
||||
let _ = substream.start_send_unpin(message);
|
||||
// Calling `start_send_unpin` only queues the message. Actually
|
||||
// emitting the message is done with `poll_flush`. In order to
|
||||
// not introduce too much complexity, this flushing is done earlier
|
||||
// in the body of this `poll()` method. As such, we schedule a task
|
||||
// wake-up now in order to guarantee that `poll()` will be called
|
||||
// again and the flush happening.
|
||||
// At the time of the writing of this comment, a rewrite of this
|
||||
// code is being planned. If you find this comment in the wild and
|
||||
// the rewrite didn't happen, please consider a refactor.
|
||||
cx.waker().wake_by_ref();
|
||||
continue 'poll_notifs_sink;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user