This repository has been archived by the owner on Sep 26, 2023. It is now read-only.
feat: update DirectPath environment variables #1412
Merged
Merged
Changes from 2 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
8250984
feat: update DirectPath environment variables
mohanli-ml d70e56b
feat: update DirectPath environment variables
mohanli-ml 5d474e2
feat: update DirectPath environment variables
mohanli-ml 58c01eb
Merge branch 'master' into disable-dp
vam-google File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -80,6 +80,7 @@ | |
@InternalExtensionOnly | ||
public final class InstantiatingGrpcChannelProvider implements TransportChannelProvider { | ||
static final String DIRECT_PATH_ENV_VAR = "GOOGLE_CLOUD_ENABLE_DIRECT_PATH"; | ||
static final String DIRECT_PATH_ENV_DISABLE_DIRECT_PATH = "GOOGLE_CLOUD_DISABLE_DIRECT_PATH"; | ||
static final long DIRECT_PATH_KEEP_ALIVE_TIME_SECONDS = 3600; | ||
static final long DIRECT_PATH_KEEP_ALIVE_TIMEOUT_SECONDS = 20; | ||
// reduce the thundering herd problem of too many channels trying to (re)connect at the same time | ||
|
@@ -246,6 +247,10 @@ public ManagedChannel createSingleChannel() throws IOException { | |
// TODO(weiranf): Use attemptDirectPath as the only indicator once setAttemptDirectPath is adapted | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please file a bug for this and reference it here There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Created b/192398509 to myself. |
||
// and the env var is removed from client environment. | ||
private boolean isDirectPathEnabled(String serviceAddress) { | ||
// Only check attemptDirectPath when DIRECT_PATH_ENV_DISABLE_DIRECT_PATH is not set. | ||
if (Boolean.parseBoolean(envProvider.getenv(DIRECT_PATH_ENV_DISABLE_DIRECT_PATH))) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This code is hard to follow due to the double negative. Probably better broken up into 3 separate statements. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
return false; | ||
} | ||
if (attemptDirectPath != null) { | ||
return attemptDirectPath; | ||
} | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
private
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.
The new ones should be private, I agree, but for the old ones, I guess it will technically make it a breaknig change
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.
I made the new one private, and keep the old one as what it is (i.e., without adding private).