Skip to content

Commit

Permalink
fix: retry storage resolve on 503
Browse files Browse the repository at this point in the history
  • Loading branch information
devgianlu committed Feb 13, 2024
1 parent 4b81804 commit 897ac6b
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions spclient/spclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,16 @@ func (c *Spclient) ResolveStorageInteractive(fileId []byte, prefetch bool) (*sto

defer func() { _ = resp.Body.Close() }()

if resp.StatusCode == 503 {
log.Debugf("storage resolve returned service unavailable, retring...")
_ = resp.Body.Close()

resp, err = c.request("GET", path, nil, nil, nil)
if err != nil {
return nil, err
}
}

if resp.StatusCode != 200 {
return nil, fmt.Errorf("invalid status code from storage resolve: %d", resp.StatusCode)
}
Expand Down

0 comments on commit 897ac6b

Please sign in to comment.