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

GRPC example - rewrite using interceptor #2272

Merged
merged 2 commits into from Dec 11, 2022

Conversation

zifter
Copy link

@zifter zifter commented Dec 9, 2022

It's better to use interceptor instead of old approach described in old example
I'm using suggested interceptor and it's working pretty good.

@cyberw
Copy link
Collaborator

cyberw commented Dec 10, 2022

Looks nice. Can you add a small note to the docs about how this approach differs from Rpc example? (Callback instead of wrapper)

Oh, and are you sure import grpc.experimental.gevent as grpc_gevent etc is no longer needed? Have you tested it with many concurrent users?

@zifter
Copy link
Author

zifter commented Dec 11, 2022

@cyberw thanks for review!
Generally speaking, it's the same wrapper pattern, but implemented natively in grpc library. A bit more information about grpc interceptors. It's definitely not a callback, because interceptors wraps the original request, and a set of interceptors become a chain during a method call. So, who is working with grpc should know that pattern.

I didn't remove import grpc.experimental.gevent as grpc_gevent, it's moved because of correct import order in python.

Yes, I have tested with many users locally, it's working.

@cyberw
Copy link
Collaborator

cyberw commented Dec 11, 2022

Ah, I misread. Looks nice now!

@cyberw cyberw merged commit e60c1f5 into locustio:master Dec 11, 2022
@zifter zifter deleted the feature/grpc-interceptor-example branch December 11, 2022 18:21
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.

None yet

2 participants