From 6bd3e971865531970b390883970f472521a33176 Mon Sep 17 00:00:00 2001 From: JustAnotherArchivist Date: Sun, 25 Apr 2021 17:47:23 +0000 Subject: [PATCH] Only increment download counter on files that have a download limit For files that have no limit, there is no reason to track the download counter as its value will never be used anyway. This reduces costs on storage backends that have an operation fee (e.g. AWS S3) or a minimum retention (e.g. Wasabi S3). --- server/handlers.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/handlers.go b/server/handlers.go index 5bcce03d..4c4d59ea 100644 --- a/server/handlers.go +++ b/server/handlers.go @@ -661,7 +661,7 @@ func (s *Server) CheckMetadata(token, filename string, increaseDownload bool) (M return metadata, errors.New("MaxDownloads expired.") } else if !metadata.MaxDate.IsZero() && time.Now().After(metadata.MaxDate) { return metadata, errors.New("MaxDate expired.") - } else if increaseDownload { + } else if metadata.MaxDownloads != -1 && increaseDownload { // todo(nl5887): mutex? // update number of downloads