Enter executor context only on `Recipe` creation

This commit is contained in:
Héctor Ramón Jiménez 2020-02-16 11:31:37 +01:00
parent 75d8de93ae
commit 09cf0b7af3
2 changed files with 12 additions and 6 deletions

View File

@ -95,11 +95,18 @@ where
&mut self, &mut self,
subscription: Subscription<Hasher, Event, Message>, subscription: Subscription<Hasher, Event, Message>,
) { ) {
let futures = let Runtime {
self.subscriptions.update(subscription, self.sender.clone()); executor,
subscriptions,
sender,
..
} = self;
let futures = executor
.enter(|| subscriptions.update(subscription, sender.clone()));
for future in futures { for future in futures {
self.executor.spawn(future); executor.spawn(future);
} }
} }

View File

@ -126,7 +126,7 @@ pub trait Application: Sized {
let (mut application, init_command) = runtime.enter(|| Self::new()); let (mut application, init_command) = runtime.enter(|| Self::new());
runtime.spawn(init_command); runtime.spawn(init_command);
let subscription = runtime.enter(|| application.subscription()); let subscription = application.subscription();
runtime.track(subscription); runtime.track(subscription);
let mut title = application.title(); let mut title = application.title();
@ -255,8 +255,7 @@ pub trait Application: Sized {
debug.update_finished(); debug.update_finished();
} }
let subscription = let subscription = application.subscription();
runtime.enter(|| application.subscription());
runtime.track(subscription); runtime.track(subscription);
// Update window title // Update window title