mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-24 06:35:45 +00:00
Overseer: subsystems communicate directly (#2227)
* overseer: pass messages directly between subsystems * test that message is held on to * Update node/overseer/src/lib.rs Co-authored-by: Peter Goodspeed-Niklaus <coriolinus@users.noreply.github.com> * give every subsystem an unbounded sender too * remove metered_channel::name 1. we don't provide good names 2. these names are never used anywhere * unused mut * remove unnecessary &mut * subsystem unbounded_send * remove unused MaybeTimer We have channel size metrics that serve the same purpose better now and the implementation of message timing was pretty ugly. * remove comment * split up senders and receivers * update metrics * fix tests * fix test subsystem context * fix flaky test * fix docs * doc * use select_biased to favor signals * Update node/subsystem/src/lib.rs Co-authored-by: Andronik Ordian <write@reusable.software> Co-authored-by: Peter Goodspeed-Niklaus <coriolinus@users.noreply.github.com> Co-authored-by: Andronik Ordian <write@reusable.software>
This commit is contained in:
committed by
GitHub
parent
c6f07d8f31
commit
5952e790fa
@@ -25,10 +25,9 @@ use super::Meter;
|
||||
|
||||
|
||||
/// Create a wrapped `mpsc::channel` pair of `MeteredSender` and `MeteredReceiver`.
|
||||
pub fn unbounded<T>(name: &'static str) -> (UnboundedMeteredSender<T>, UnboundedMeteredReceiver<T>) {
|
||||
pub fn unbounded<T>() -> (UnboundedMeteredSender<T>, UnboundedMeteredReceiver<T>) {
|
||||
let (tx, rx) = mpsc::unbounded();
|
||||
let mut shared_meter = Meter::default();
|
||||
shared_meter.name = name;
|
||||
let shared_meter = Meter::default();
|
||||
let tx = UnboundedMeteredSender { meter: shared_meter.clone(), inner: tx };
|
||||
let rx = UnboundedMeteredReceiver { meter: shared_meter, inner: rx };
|
||||
(tx, rx)
|
||||
@@ -147,7 +146,7 @@ impl<T> UnboundedMeteredSender<T> {
|
||||
|
||||
|
||||
/// Attempt to send message or fail immediately.
|
||||
pub fn unbounded_send(&mut self, msg: T) -> result::Result<(), mpsc::TrySendError<T>> {
|
||||
pub fn unbounded_send(&self, msg: T) -> result::Result<(), mpsc::TrySendError<T>> {
|
||||
self.meter.note_sent();
|
||||
self.inner.unbounded_send(msg).map_err(|e| {
|
||||
self.meter.retract_sent();
|
||||
|
||||
Reference in New Issue
Block a user