Skip to content
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

fix(transport): return GDU for all errors from MDS universe_domain #2484

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 5 additions & 4 deletions internal/settings.go
Expand Up @@ -195,7 +195,7 @@ func (ds *DialSettings) IsUniverseDomainGDU() bool {
// GetUniverseDomain returns the default service domain for a given Cloud
// universe, from google.Credentials, for comparison with the value returned by
// (*DialSettings).GetUniverseDomain. This wrapper function should be removed
// to close [TODO(chrisdsmith): issue link here]. See details below.
// to close https://github.com/googleapis/google-api-go-client/issues/2399.
func GetUniverseDomain(creds *google.Credentials) (string, error) {
timer := time.NewTimer(time.Second)
defer timer.Stop()
Expand All @@ -212,9 +212,10 @@ func GetUniverseDomain(creds *google.Credentials) (string, error) {
}()

select {
case err := <-errors:
// An error that is returned before the timer expires is legitimate.
return "", err
case <-errors:
// An error that is returned before the timer expires is likely to be
// connection refused. Temporarily (2024-03-21) return the GDU domain.
return universeDomainDefault, nil
case res := <-results:
return res, nil
case <-timer.C: // Timer is expired.
Expand Down