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
Support retrying gRPCs with chained interceptors #100
Conversation
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed, please reply here (e.g.
|
Codecov Report
@@ Coverage Diff @@
## master #100 +/- ##
==========================================
+ Coverage 73.2% 73.68% +0.47%
==========================================
Files 36 36
Lines 1284 1292 +8
==========================================
+ Hits 940 952 +12
+ Misses 295 293 -2
+ Partials 49 47 -2
Continue to review full report at Codecov.
|
I signed it! |
CLAs look good, thanks! |
ping @alcore can you review this? thanks |
@marcwilson-g could you update the documentation explicit that the retry will call every interceptor after the retry when a retry happens. |
Back from leave today! |
Hey Marc, sorry for the delay getting back to you. The if you run make it should auto generate the .MD files for you. |
As retries may cause a handler chain to be partially re-executed the interceptor needs to be reset as the recursion unrolls.
0b03e1c
to
21b739d
Compare
@domgreen Done! |
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.
Thanks Marc, will chase someone to accept the PR :)
@@ -31,7 +31,9 @@ func ChainUnaryServer(interceptors ...grpc.UnaryServerInterceptor) grpc.UnarySer | |||
return handler(currentCtx, currentReq) | |||
} | |||
curI++ | |||
return interceptors[curI](currentCtx, currentReq, info, chainHandler) | |||
resp, err := interceptors[curI](currentCtx, currentReq, info, chainHandler) | |||
curI-- |
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.
Why sever side also need curI--
?
As retries may cause a handler chain to be partially re-executed the
interceptor needs to be reset as the recursion unrolls.
Fix for #110
Possibly regressed as part of
5d4723c
Added tests to the retry_test as this case seemed retry specific, but did feel odd to test the chaining in the retry.