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

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

Merged
andreamlin merged 7 commits into
googleapis:masterfrom
andreamlin:max_attempts_retry
May 15, 2019
Merged

Set rpcTimeout to be totalTimeout for non-retried methods#712
andreamlin merged 7 commits into
googleapis:masterfrom
andreamlin:max_attempts_retry

Conversation

@andreamlin

@andreamlinandreamlin commented May 13, 2019

Copy link
Copy Markdown
Contributor

Fixes#711.

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

Copy link
Copy Markdown
ContributorAuthor

PTAL

@codecov

codecovBot commented May 13, 2019

Copy link
Copy Markdown

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 FilesCoverage ΔComplexity Δ
...rc/main/java/com/google/api/gax/rpc/Callables.java67.34% <50%> (-1.55%)10 <0> (ø)
...a/com/google/api/gax/grpc/GrpcCallableFactory.java78.75% <0%> (+3.75%)10% <0%> (+1%)⬆️
...java/com/google/api/gax/grpc/GrpcCallSettings.java78.94% <0%> (+10.52%)5% <0%> (ø)⬇️
...le/api/gax/grpc/GrpcUnaryRequestParamCallable.java90% <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.

@andreamlinandreamlin changed the title Retries are not disabled when maxAttempts == 1Set rpcTimeout to be totalTimeout for non-retried methodsMay 15, 2019
@andreamlin

andreamlin commented May 15, 2019

Copy link
Copy Markdown
ContributorAuthor

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

ClientContext clientContext) {

if (areRetriesDisabled(callSettings.getRetryableCodes())) {
return innerCallable;

Copy link
Copy Markdown
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
Copy Markdown
ContributorAuthor

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
Copy Markdown
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:

@RulepublicMockitoRulemockitoRule = MockitoJUnit.rule().strictness(Strictness.STRICT_STUBS);
@MockprivateApiTracermockTracer;

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Sure

Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

cla: yesThis human has signed the Contributor License Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Broken setSimpleTimeoutNoRetries()

3 participants

@andreamlin@igorbernstein2@googlebot