Skip to content

Commit

Permalink
fix(transport): return GDU for all errors from MDS universe_domain
Browse files Browse the repository at this point in the history
refs: #2399
  • Loading branch information
quartzmo committed Mar 21, 2024
1 parent 9599561 commit 9d58549
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions internal/settings.go
Original file line number Diff line number Diff line change
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

0 comments on commit 9d58549

Please sign in to comment.