Skip to content

Conversation

@karlseguin
Copy link
Collaborator

@karlseguin karlseguin commented Oct 9, 2025

When using CDP, we poll the HTTP clients along with the CDP socket. Because this polling can be long, we first process any pending message. This can end up processing all messages, in which case the poll will block for a long time.

This change makes it so that when the initial processing processes 1+ message, we do not poll, but rather return. This allows the page lifecycle to be processed normally (and not just blocking on poll, waiting for the CDP client to send data).

Without this PR, this very simple CDP script timesout: lightpanda-io/demo#79

When using CDP, we poll the HTTP clients along with the CDP socket. Because this
polling can be long, we first process any pending message. This can end up
processing _all_ messages, in which case the poll will block for a long time.

This change makes it so that when the initial processing processes 1+ message,
we do not poll, but rather return. This allows the page lifecycle to be
processed normally (and not just blocking on poll, waiting for the CDP client
to send data).
karlseguin added a commit to lightpanda-io/demo that referenced this pull request Oct 9, 2025
This test requires lightpanda-io/browser#1132 to pass
otherwise, the code just hangs.
@karlseguin karlseguin merged commit dc85c65 into main Oct 9, 2025
10 checks passed
@karlseguin karlseguin deleted the reduce_http_tick_blocking branch October 9, 2025 06:14
@github-actions github-actions bot locked and limited conversation to collaborators Oct 9, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants