Skip to content

Commit

Permalink
add timeout checks for downstream errors
Browse files Browse the repository at this point in the history
  • Loading branch information
wbrowne committed Aug 27, 2024
1 parent 4cba513 commit 09bdebe
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions backend/error_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ import (
"context"
"errors"
"fmt"
"net"
"net/http"
"os"
)

// ErrorSource type defines the source of the error
Expand Down Expand Up @@ -62,6 +64,15 @@ func IsDownstreamError(err error) bool {
return true
}

// if error is HTTP network timeout error, we should treat it as downstream error
if err, ok := err.(net.Error); ok && err.Timeout() {
return true
}

if os.IsTimeout(err) {
return true
}

return false
}

Expand Down

0 comments on commit 09bdebe

Please sign in to comment.