From 563330b82accdfb3eb4a5c49b1f0a600d8ca420a Mon Sep 17 00:00:00 2001 From: Robert Swain Date: Thu, 11 May 2017 09:16:20 +0200 Subject: [PATCH] mediaapi/writers/download: Rename attempts to tries Tries is more usual language in programming. --- .../matrix-org/dendrite/mediaapi/writers/download.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/github.com/matrix-org/dendrite/mediaapi/writers/download.go b/src/github.com/matrix-org/dendrite/mediaapi/writers/download.go index 93382b635..eb47237c0 100644 --- a/src/github.com/matrix-org/dendrite/mediaapi/writers/download.go +++ b/src/github.com/matrix-org/dendrite/mediaapi/writers/download.go @@ -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,