Rework page wait again

Further reducing bouncing between page and server for loop polling. If there is
a page, the page polls. If there isn't a page, the server polls. Simpler.
This commit is contained in:
Karl Seguin
2025-09-03 19:37:09 +08:00
parent e237e709b6
commit b6137b03cd
12 changed files with 185 additions and 179 deletions

View File

@@ -116,11 +116,13 @@ pub fn CDPT(comptime TypeProvider: type) type {
// A bit hacky right now. The main server loop doesn't unblock for
// scheduled task. So we run this directly in order to process any
// timeouts (or http events) which are ready to be processed.
pub fn pageWait(self: *Self) void {
const session = &(self.browser.session orelse return);
// exits early if there's nothing to do, so a large value like
// 5 seconds should be ok
session.wait(5);
pub fn hasPage() bool {
}
pub fn pageWait(self: *Self, ms: i32) Session.WaitResult {
const session = &(self.browser.session orelse return .no_page);
return session.wait(ms);
}
// Called from above, in processMessage which handles client messages