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,
|
at: SystemTime,
|
||||||
palette: theme::Palette,
|
palette: theme::Palette,
|
||||||
},
|
},
|
||||||
SubscriptionsTracked {
|
|
||||||
at: SystemTime,
|
|
||||||
amount_alive: usize,
|
|
||||||
},
|
|
||||||
SpanFinished {
|
SpanFinished {
|
||||||
at: SystemTime,
|
at: SystemTime,
|
||||||
duration: Duration,
|
duration: Duration,
|
||||||
|
|
@ -84,7 +80,6 @@ impl Event {
|
||||||
Self::Connected { at, .. }
|
Self::Connected { at, .. }
|
||||||
| Self::Disconnected { at, .. }
|
| Self::Disconnected { at, .. }
|
||||||
| Self::ThemeChanged { at, .. }
|
| Self::ThemeChanged { at, .. }
|
||||||
| Self::SubscriptionsTracked { at, .. }
|
|
||||||
| Self::SpanFinished { at, .. }
|
| Self::SpanFinished { at, .. }
|
||||||
| Self::QuitRequested { at }
|
| Self::QuitRequested { at }
|
||||||
| Self::AlreadyRunning { at } => *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 (command_sender, mut command_receiver) = mpsc::channel(1);
|
||||||
let mut last_message = String::new();
|
let mut last_message = String::new();
|
||||||
let mut last_update_number = 0;
|
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;
|
let mut last_present_window = None;
|
||||||
|
|
||||||
drop(task::spawn(async move {
|
drop(task::spawn(async move {
|
||||||
|
|
@ -189,12 +185,7 @@ pub fn run() -> impl Stream<Item = Event> {
|
||||||
client::Event::SubscriptionsTracked(
|
client::Event::SubscriptionsTracked(
|
||||||
amount_alive,
|
amount_alive,
|
||||||
) => {
|
) => {
|
||||||
let _ = output
|
last_subscriptions = amount_alive;
|
||||||
.send(Event::SubscriptionsTracked {
|
|
||||||
at,
|
|
||||||
amount_alive,
|
|
||||||
})
|
|
||||||
.await;
|
|
||||||
}
|
}
|
||||||
client::Event::MessageLogged {
|
client::Event::MessageLogged {
|
||||||
number,
|
number,
|
||||||
|
|
@ -206,13 +197,13 @@ pub fn run() -> impl Stream<Item = Event> {
|
||||||
client::Event::CommandsSpawned(
|
client::Event::CommandsSpawned(
|
||||||
commands,
|
commands,
|
||||||
) => {
|
) => {
|
||||||
last_commands_spawned = commands;
|
last_tasks = commands;
|
||||||
}
|
}
|
||||||
client::Event::SpanStarted(
|
client::Event::SpanStarted(
|
||||||
span::Stage::Update,
|
span::Stage::Update,
|
||||||
) => {
|
) => {
|
||||||
last_message.clear();
|
last_message.clear();
|
||||||
last_commands_spawned = 0;
|
last_tasks = 0;
|
||||||
}
|
}
|
||||||
client::Event::SpanStarted(
|
client::Event::SpanStarted(
|
||||||
span::Stage::Present(window),
|
span::Stage::Present(window),
|
||||||
|
|
@ -231,8 +222,9 @@ pub fn run() -> impl Stream<Item = Event> {
|
||||||
number: last_update_number,
|
number: last_update_number,
|
||||||
message: last_message
|
message: last_message
|
||||||
.clone(),
|
.clone(),
|
||||||
commands_spawned:
|
tasks: last_tasks,
|
||||||
last_commands_spawned,
|
subscriptions:
|
||||||
|
last_subscriptions,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
span::Stage::View(window) => {
|
span::Stage::View(window) => {
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,8 @@ pub enum Span {
|
||||||
Update {
|
Update {
|
||||||
number: usize,
|
number: usize,
|
||||||
message: String,
|
message: String,
|
||||||
commands_spawned: usize,
|
tasks: usize,
|
||||||
|
subscriptions: usize,
|
||||||
},
|
},
|
||||||
View {
|
View {
|
||||||
window: window::Id,
|
window: window::Id,
|
||||||
|
|
|
||||||
|
|
@ -254,12 +254,10 @@ where
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
Event::Program(message) => {
|
Event::Program(message) => {
|
||||||
{
|
self.time_machine.push(&message);
|
||||||
self.time_machine.push(&message);
|
|
||||||
|
|
||||||
if self.time_machine.is_rewinding() {
|
if self.time_machine.is_rewinding() {
|
||||||
debug::enable();
|
debug::enable();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let span = debug::update(&message);
|
let span = debug::update(&message);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue