Skip to content

Commit

Permalink
Add thumbnail upload retries (#982)
Browse files Browse the repository at this point in the history
Increase the timeout after seeing quite high response times from Storj
  • Loading branch information
mjh1 authored Nov 21, 2023
1 parent 3eec2e0 commit 647deb5
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions thumbnails/thumbnails.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,17 +90,19 @@ func GenerateThumbs(requestID, input string, output *url.URL) error {
for _, thumbOut := range thumbOuts {
thumbOut := thumbOut
uploadGroup.Go(func() error {
// upload thumbnail to storage
fileReader, err := os.Open(thumbOut)
if err != nil {
return err
}
defer fileReader.Close()
err = clients.UploadToOSURL(outputLocation, path.Base(thumbOut), fileReader, time.Minute)
if err != nil {
return fmt.Errorf("failed to upload thumbnail %s: %w", thumbOut, err)
}
return nil
return backoff.Retry(func() error {
// upload thumbnail to storage
fileReader, err := os.Open(thumbOut)
if err != nil {
return err
}
defer fileReader.Close()
err = clients.UploadToOSURL(outputLocation, path.Base(thumbOut), fileReader, 2*time.Minute)
if err != nil {
return fmt.Errorf("failed to upload thumbnail %s: %w", thumbOut, err)
}
return nil
}, clients.UploadRetryBackoff())
})
}
err = uploadGroup.Wait()
Expand Down

0 comments on commit 647deb5

Please sign in to comment.