Skip to content

Lightpanda: the headless browser designed for AI and automation

disable poll (0) if there's a foreground task

Karl Seguin52cb8cf47b40
diff --git a/src/browser/Runner.zig b/src/browser/Runner.zig
index e648e89a8..354451e1e 100644
--- a/src/browser/Runner.zig
+++ b/src/browser/Runner.zig
@@ -317,6 +317,9 @@ fn _tick(self: *Runner, comptime is_cdp: bool, timeout_ms: u32, conditions: []Wa
if (has_runnable_page == false) {
break :blk 200;
}
+ if (browser.foreground_task_posted.load(.acquire)) {
+ break :blk 0;
+ }
break :blk browser.msToNextTask() orelse 200;
};
const ms_to_wait = @min(timeout_ms, ms_to_next_task);