mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-07 23:13:11 -06:00
mediaapi/writers/download: Rename attempts to tries
Tries is more usual language in programming.
This commit is contained in:
parent
304a275e1b
commit
563330b82a
|
|
@ -81,7 +81,7 @@ var errRead = fmt.Errorf("failed to read response from remote server")
|
|||
var errResponse = fmt.Errorf("failed to write file data to response body")
|
||||
var errWrite = fmt.Errorf("failed to write file to disk")
|
||||
|
||||
var nAttempts = 5
|
||||
var nTries = 5
|
||||
|
||||
// Download implements /download
|
||||
// Files from this server (i.e. origin == cfg.ServerName) are served directly
|
||||
|
|
@ -129,7 +129,7 @@ func Download(w http.ResponseWriter, req *http.Request, origin types.ServerName,
|
|||
|
||||
mxcURL := "mxc://" + string(r.MediaMetadata.Origin) + "/" + string(r.MediaMetadata.MediaID)
|
||||
|
||||
for attempts := 0; ; attempts++ {
|
||||
for tries := 0; ; tries++ {
|
||||
activeRemoteRequests.Lock()
|
||||
err = db.GetMediaMetadata(r.MediaMetadata.MediaID, r.MediaMetadata.Origin, r.MediaMetadata)
|
||||
if err == nil {
|
||||
|
|
@ -139,7 +139,7 @@ func Download(w http.ResponseWriter, req *http.Request, origin types.ServerName,
|
|||
return
|
||||
}
|
||||
if activeRemoteRequestCondition, ok := activeRemoteRequests.Set[mxcURL]; ok {
|
||||
if attempts >= nAttempts {
|
||||
if tries >= nTries {
|
||||
logger.Warnf("Other goroutines are trying to download the remote file and failing.")
|
||||
jsonErrorResponse(w, util.JSONResponse{
|
||||
Code: 500,
|
||||
|
|
|
|||
Loading…
Reference in a new issue