Track commands spawned and subscriptions alive in beacon

This commit is contained in:
Héctor Ramón Jiménez 2024-05-13 13:21:10 +02:00
parent e770804435
commit b8adfc9ffe
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
8 changed files with 131 additions and 35 deletions

View file

@ -557,7 +557,11 @@ async fn run_instance<A, E, C>(
&mut proxy,
&window,
);
runtime.track(application.subscription().into_recipes());
let recipes = application.subscription().into_recipes();
debug::subscriptions_tracked(recipes.len());
runtime.track(recipes);
boot_span.finish();
let mut user_interface = ManuallyDrop::new(build_user_interface(
@ -897,11 +901,8 @@ pub fn update<A: Application, C, E: Executor>(
A::Theme: DefaultStyle,
{
for message in messages.drain(..) {
debug::log_message(&message);
let update_span = debug::update();
let update_span = debug::update(&message);
let command = runtime.enter(|| application.update(message));
update_span.finish();
run_command(
application,
@ -917,12 +918,14 @@ pub fn update<A: Application, C, E: Executor>(
proxy,
window,
);
update_span.finish();
}
state.synchronize(application, window);
let subscription = application.subscription();
runtime.track(subscription.into_recipes());
let recipes = application.subscription().into_recipes();
debug::subscriptions_tracked(recipes.len());
runtime.track(recipes);
}
/// Runs the actions of a [`Command`].
@ -949,7 +952,10 @@ pub fn run_command<A, C, E>(
use crate::runtime::system;
use crate::runtime::window;
for action in command.actions() {
let actions = command.actions();
debug::commands_spawned(actions.len());
for action in actions {
match action {
command::Action::Future(future) => {
runtime.spawn(future);