Unify SubscriptionsTracked with Span::Update
This commit is contained in:
parent
5ce3892a1e
commit
a105ad4f9f
3 changed files with 13 additions and 22 deletions
|
|
@ -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<Item = Event> {
|
|||
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<Item = Event> {
|
|||
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<Item = Event> {
|
|||
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<Item = Event> {
|
|||
number: last_update_number,
|
||||
message: last_message
|
||||
.clone(),
|
||||
commands_spawned:
|
||||
last_commands_spawned,
|
||||
tasks: last_tasks,
|
||||
subscriptions:
|
||||
last_subscriptions,
|
||||
}
|
||||
}
|
||||
span::Stage::View(window) => {
|
||||
|
|
|
|||
|
|
@ -8,7 +8,8 @@ pub enum Span {
|
|||
Update {
|
||||
number: usize,
|
||||
message: String,
|
||||
commands_spawned: usize,
|
||||
tasks: usize,
|
||||
subscriptions: usize,
|
||||
},
|
||||
View {
|
||||
window: window::Id,
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue