Skip to content

Commit

Permalink
Increase timeout of fetching access token from metadata server to 5s (#…
Browse files Browse the repository at this point in the history
…798)

* Increase timeout of fetching access token from metadata server to 5s

Signed-off-by: Wayne Zhang <qiwzhang@google.com>

* fix metadata_timeout test

Signed-off-by: Wayne Zhang <qiwzhang@google.com>
  • Loading branch information
qiwzhang authored May 20, 2020
1 parent b840c62 commit 9edee44
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions src/api_manager/fetch_metadata.cc
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,11 @@ const char kMetadataInstanceIdentityToken[] =
const int kInstanceIdentityTokenExpiration = 3500;
// Time window (in seconds) of failure status after a failed fetch.
const int kFailureStatusWindow = 5;
// Initial metadata fetch timeout (1s)
const int kMetadataFetchTimeout = 1000;
// GKE metadata server may take >2s to fetch access token.
// Initial metadata fetch timeout (5s)
const int kMetadataFetchTimeout = 5000;
// Maximum number of retries to fetch token from metadata
const int kMetadataTokenFetchRetries = 5;
const int kMetadataTokenFetchRetries = 3;
// External status message for failure to fetch service account token
const char kFailedTokenFetch[] = "Failed to fetch service account token";
// External status message for token fetch in progress
Expand Down
2 changes: 1 addition & 1 deletion src/nginx/t/metadata_timeout.t
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ sub metadata {
$request_count++;
if ($request_count == 1) {
# Trigger a timeout for the first request.
sleep 2;
sleep 7;
}

print $client <<'EOF';
Expand Down

0 comments on commit 9edee44

Please sign in to comment.