Skip to content

Commit 1963e4a

Browse files
committed
Don't process idle tasks in browser prompts
1 parent 076e879 commit 1963e4a

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

crates/ark/src/interface.rs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -766,7 +766,18 @@ impl RMain {
766766
let stdin_reply_index = select.recv(&stdin_reply_rx);
767767
let kernel_request_index = select.recv(&kernel_request_rx);
768768
let tasks_interrupt_index = select.recv(&tasks_interrupt_rx);
769-
let tasks_idle_index = select.recv(&tasks_idle_rx);
769+
770+
// Don't process idle tasks in browser prompts. We currently don't want
771+
// idle tasks (e.g. for srcref generation) to run when the call stack is
772+
// empty. We could make this configurable though if needed, i.e. some
773+
// idle tasks would be able to run in the browser. Those should be sent
774+
// to a dedicated channel that would always be included in the set of
775+
// recv channels.
776+
let tasks_idle_index = if info.browser {
777+
None
778+
} else {
779+
Some(select.recv(&tasks_idle_rx))
780+
};
770781

771782
loop {
772783
// If an interrupt was signaled and we are in a user
@@ -846,7 +857,7 @@ impl RMain {
846857
},
847858

848859
// An idle task woke us up
849-
i if i == tasks_idle_index => {
860+
i if Some(i) == tasks_idle_index => {
850861
let task = oper.recv(&tasks_idle_rx).unwrap();
851862
self.handle_task(task);
852863
},

0 commit comments

Comments
 (0)