Skip to content
This repository has been archived by the owner on Sep 26, 2023. It is now read-only.

Set rpcTimeout to be totalTimeout for non-retried methods #712

Merged
merged 7 commits into from
May 15, 2019

Conversation

andreamlin
Copy link
Contributor

@andreamlin andreamlin commented May 13, 2019

Fixes #711.

@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label May 13, 2019
@andreamlin
Copy link
Contributor Author

PTAL

@codecov
Copy link

codecov bot commented May 13, 2019

Codecov Report

Merging #712 into master will increase coverage by 0.27%.
The diff coverage is 50%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #712      +/-   ##
============================================
+ Coverage     75.46%   75.74%   +0.27%     
- Complexity     1037     1041       +4     
============================================
  Files           196      196              
  Lines          4675     4679       +4     
  Branches        363      363              
============================================
+ Hits           3528     3544      +16     
+ Misses          986      975      -11     
+ Partials        161      160       -1
Impacted Files Coverage Δ Complexity Δ
...rc/main/java/com/google/api/gax/rpc/Callables.java 67.34% <50%> (-1.55%) 10 <0> (ø)
...a/com/google/api/gax/grpc/GrpcCallableFactory.java 78.75% <0%> (+3.75%) 10% <0%> (+1%) ⬆️
...java/com/google/api/gax/grpc/GrpcCallSettings.java 78.94% <0%> (+10.52%) 5% <0%> (ø) ⬇️
...le/api/gax/grpc/GrpcUnaryRequestParamCallable.java 90% <0%> (+90%) 3% <0%> (+3%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update dc2bf4e...19ff63b. Read the comment docs.

@andreamlin andreamlin changed the title Retries are not disabled when maxAttempts == 1 Set rpcTimeout to be totalTimeout for non-retried methods May 15, 2019
@andreamlin
Copy link
Contributor Author

andreamlin commented May 15, 2019

PTAL again, changed the implementation again to what @igorbernstein2 proposed in #711

@@ -56,7 +56,10 @@ private Callables() {}
ClientContext clientContext) {

if (areRetriesDisabled(callSettings.getRetryableCodes())) {
return innerCallable;
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this (and below) could use a comment. Something like:

// When retries are disabled, the total timeout can be treated as the rpc timeout.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

private static final Duration totalTimeout = Duration.ofDays(DEADLINE_IN_DAYS);

@SuppressWarnings("unchecked")
private static final Marshaller<String> stringMarshaller = Mockito.mock(Marshaller.class);
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider using the MockitoRule with the @Mock annotation here. See here for an example:

@Rule public MockitoRule mockitoRule = MockitoJUnit.rule().strictness(Strictness.STRICT_STUBS);
@Mock private ApiTracer mockTracer;

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Broken setSimpleTimeoutNoRetries()
3 participants