Skip to content

Commit

Permalink
fix(compute/metadata): check error chain for retryable error (#10840)
Browse files Browse the repository at this point in the history
Thanks to @ianlancetaylor for pointing this out!
  • Loading branch information
codyoss committed Sep 10, 2024
1 parent 2d5a9f9 commit 2bdedef
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions compute/metadata/retry_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,15 @@

package metadata

import "syscall"
import (
"errors"
"syscall"
)

func init() {
// Initialize syscallRetryable to return true on transient socket-level
// errors. These errors are specific to Linux.
syscallRetryable = func(err error) bool { return err == syscall.ECONNRESET || err == syscall.ECONNREFUSED }
syscallRetryable = func(err error) bool {
return errors.Is(err, syscall.ECONNRESET) || errors.Is(err, syscall.ECONNREFUSED)
}
}

0 comments on commit 2bdedef

Please sign in to comment.