Skip to content

Commit

Permalink
Poling translations infinite loop fix
Browse files Browse the repository at this point in the history
If downloading translations fails due
to reasons such as the inability to
create the downloaded file
the  "redirect" field in the
response is empty and status is falied
Based on backoff functionality, a request will be retried after
1s, 1s, 1s, 2s, 3s, 5s, 8s, 13s and then after 13s forever
To avoid this we can break the loop if status of task is failed

Remove retries
  • Loading branch information
foteinigk committed Jul 31, 2023
1 parent 5acb442 commit 2e68793
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pkg/txapi/resource_translations_async_downloads.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ func PollTranslationDownload(download *jsonapi.Resource, filePath string) error
}
if download.Redirect != "" {
break
} else if download.Attributes["status"] == "failed" {
return fmt.Errorf(
"download of translation '%s' failed",
download.Relationships["resource"].DataSingular.Id,
)
}
}
resp, err := http.Get(download.Redirect)
Expand Down

0 comments on commit 2e68793

Please sign in to comment.