From a105ad4f9f9442312402c56c26555e587562b0b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A9ctor=20Ram=C3=B3n=20Jim=C3=A9nez?= Date: Mon, 21 Apr 2025 05:12:08 +0200 Subject: [PATCH] Unify `SubscriptionsTracked` with `Span::Update` --- beacon/src/lib.rs | 24 ++++++++---------------- beacon/src/span.rs | 3 ++- devtools/src/lib.rs | 8 +++----- 3 files changed, 13 insertions(+), 22 deletions(-) diff --git a/beacon/src/lib.rs b/beacon/src/lib.rs index e7fe9d75..a5291e32 100644 --- a/beacon/src/lib.rs +++ b/beacon/src/lib.rs @@ -61,10 +61,6 @@ pub enum Event { at: SystemTime, palette: theme::Palette, }, - SubscriptionsTracked { - at: SystemTime, - amount_alive: usize, - }, SpanFinished { at: SystemTime, duration: Duration, @@ -84,7 +80,6 @@ impl Event { Self::Connected { at, .. } | Self::Disconnected { at, .. } | Self::ThemeChanged { at, .. } - | Self::SubscriptionsTracked { at, .. } | Self::SpanFinished { at, .. } | Self::QuitRequested { at } | Self::AlreadyRunning { at } => *at, @@ -129,7 +124,8 @@ pub fn run() -> impl Stream { let (command_sender, mut command_receiver) = mpsc::channel(1); let mut last_message = String::new(); let mut last_update_number = 0; - let mut last_commands_spawned = 0; + let mut last_tasks = 0; + let mut last_subscriptions = 0; let mut last_present_window = None; drop(task::spawn(async move { @@ -189,12 +185,7 @@ pub fn run() -> impl Stream { client::Event::SubscriptionsTracked( amount_alive, ) => { - let _ = output - .send(Event::SubscriptionsTracked { - at, - amount_alive, - }) - .await; + last_subscriptions = amount_alive; } client::Event::MessageLogged { number, @@ -206,13 +197,13 @@ pub fn run() -> impl Stream { client::Event::CommandsSpawned( commands, ) => { - last_commands_spawned = commands; + last_tasks = commands; } client::Event::SpanStarted( span::Stage::Update, ) => { last_message.clear(); - last_commands_spawned = 0; + last_tasks = 0; } client::Event::SpanStarted( span::Stage::Present(window), @@ -231,8 +222,9 @@ pub fn run() -> impl Stream { number: last_update_number, message: last_message .clone(), - commands_spawned: - last_commands_spawned, + tasks: last_tasks, + subscriptions: + last_subscriptions, } } span::Stage::View(window) => { diff --git a/beacon/src/span.rs b/beacon/src/span.rs index 453ef1bd..ff869e1e 100644 --- a/beacon/src/span.rs +++ b/beacon/src/span.rs @@ -8,7 +8,8 @@ pub enum Span { Update { number: usize, message: String, - commands_spawned: usize, + tasks: usize, + subscriptions: usize, }, View { window: window::Id, diff --git a/devtools/src/lib.rs b/devtools/src/lib.rs index 1af99b22..1126bcf9 100644 --- a/devtools/src/lib.rs +++ b/devtools/src/lib.rs @@ -254,12 +254,10 @@ where } }, Event::Program(message) => { - { - self.time_machine.push(&message); + self.time_machine.push(&message); - if self.time_machine.is_rewinding() { - debug::enable(); - } + if self.time_machine.is_rewinding() { + debug::enable(); } let span = debug::update(&message);