Skip to content
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

Allow Interceptors to add EventListeners. #7447

Draft
wants to merge 11 commits into
base: master
Choose a base branch
from

Conversation

yschimke
Copy link
Collaborator

#fixes #7164

@yschimke
Copy link
Collaborator Author

@oldergod related to #7297 somewhat, I wonder if we want to allow adding an EventListener to a Call before it's executed or cancelled?

@yschimke yschimke marked this pull request as ready for review September 10, 2022 14:42
Copy link
Member

@oldergod oldergod left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM but needs a Jesse review before merging

@yschimke yschimke marked this pull request as draft December 30, 2022 04:45
@yschimke yschimke marked this pull request as ready for review December 30, 2022 07:31
# Conflicts:
#	okhttp-testing-support/src/main/kotlin/okhttp3/RecordingEventListener.kt
@yschimke
Copy link
Collaborator Author

yschimke commented Jan 3, 2023

@swankjesse any thoughts on this?

@yschimke
Copy link
Collaborator Author

yschimke commented Jan 8, 2023

@swankjesse ping, it would be good to get this into an alpha for bridge integrations.

@swankjesse
Copy link
Member

I’m not sold on this.

I think the top-level goal is reasonable, but this implementation isn’t consistent with our other with methods on interceptors – this collects all events; not the events downstream of proceed. In particular I think the with method would at minimum need to be add.

But then I don’t like other side-effects this can trigger. Like if the interceptor runs 2x, it’ll add the listener 2x.

I think if we really wanted this behavior, we’d be better off adding interceptors to Call objects. And we practically already have that already in OkHttpClient.

Perhaps we start with some use cases and build the API to address them, rather than taking interceptors and trying to make them more powerful.

@yschimke
Copy link
Collaborator Author

Ok, will rework.

@yschimke yschimke closed this Jan 16, 2023
@yschimke yschimke reopened this Jan 16, 2023
@yschimke yschimke marked this pull request as draft March 30, 2023 19:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Provide a clean way for Bridging Interceptors to get a cancel signal
3 participants