-
-
Notifications
You must be signed in to change notification settings - Fork 8.6k
[py]: allow CDP and BiDi event callbacks to determine event triggering order #16290
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: trunk
Are you sure you want to change the base?
Conversation
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Explore these optional code suggestions:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a test for this?
I opened #16294 for the "daemon threads" issue that the AI bot suggested. We can handle that outside this PR. |
@Delta456 I'd appreciate some suggestions. Since Any ideas? |
User description
🔗 Related Issues
An implementation of #16280
💥 What does this PR do?
This PR adds a new function,
WebSocketConnection.add_callback_with_sequence
, to provide event callbacks with an additional parameter, the event sequence number. This allows callbacks to properly order and process events that are fired repeatedly in a short time frame.The implementation referred to #13921.
🔄 Types of changes
PR Type
Enhancement
Description
Add sequence number tracking to WebSocket event callbacks
Enable event ordering for CDP and BiDi callbacks
Maintain backward compatibility with existing callback interface
Support concurrent event processing with proper sequencing
Diagram Walkthrough
File Walkthrough
websocket_connection.py
Add sequence tracking to WebSocket callbacks
py/selenium/webdriver/remote/websocket_connection.py
_sequence
counter for tracking event orderadd_callback_with_sequence
method for sequence-aware callbacksadd_callback
to use new sequence method with lambda wrapper