diff --git a/common/httpapi.go b/common/httpapi.go index 3f2a75b6e..bf634ff4a 100644 --- a/common/httpapi.go +++ b/common/httpapi.go @@ -59,7 +59,7 @@ func MakeHTMLAPI(metricsName string, f func(http.ResponseWriter, *http.Request) } } - return prometheus.InstrumentHandlerDuration(metricsName, http.HandlerFunc(withSpan)) + return prometheus.InstrumentHandler(metricsName, http.HandlerFunc(withSpan)) } // MakeInternalAPI turns a util.JSONRequestHandler function into an http.Handler. diff --git a/common/transactions/transactions.go b/common/transactions/transactions.go index dd6b8f56d..d3103c5b1 100644 --- a/common/transactions/transactions.go +++ b/common/transactions/transactions.go @@ -86,7 +86,7 @@ func (t *Cache) AddTransaction(accessToken, txnID string, res *util.JSONResponse // This cycles the txnMaps forward, i.e. back map is assigned the front and front is assigned an empty map. func cacheCleanService(t *Cache) { ticker := time.NewTicker(t.cleanupPeriod) - for range ticker { + for range ticker.C { t.Lock() t.txnsMaps[1] = t.txnsMaps[0] t.txnsMaps[0] = make(txnsMap) diff --git a/go.mod b/go.mod index dd89ed5a0..b5b6c2e80 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,7 @@ module github.com/matrix-org/dendrite require ( + github.com/PC25/naffka v0.0.0-20191204155648-20998d509638 github.com/Shopify/sarama v1.24.1 github.com/alecthomas/gometalinter v2.0.2+incompatible github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf diff --git a/go.sum b/go.sum index e9edf5344..dd687eb03 100644 --- a/go.sum +++ b/go.sum @@ -4,6 +4,8 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03 github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/OpenPeeDeeP/depguard v1.0.1 h1:VlW4R6jmBIv3/u1JNlawEvJMM4J+dPORPaZasQee8Us= github.com/OpenPeeDeeP/depguard v1.0.1/go.mod h1:xsIw86fROiiwelg+jB2uM9PiKihMMmUx/1V+TNhjQvM= +github.com/PC25/naffka v0.0.0-20191204155648-20998d509638 h1:Fux5vtVHzDykSMh3ngtpAOFq+Lm80+GftBFEFT5KAcU= +github.com/PC25/naffka v0.0.0-20191204155648-20998d509638/go.mod h1:WmZZjPXh+eUtcj7/7qUGy/VnIcLUtjDCmD5C0onZW0I= github.com/Shopify/sarama v0.0.0-20170127151855-574d3147eee3 h1:j6BAEHYn1kUyW2j7kY0mOJ/R8A0qWwXpvUAEHGemm/g= github.com/Shopify/sarama v0.0.0-20170127151855-574d3147eee3/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo= github.com/Shopify/sarama v1.24.1 h1:svn9vfN3R1Hz21WR2Gj0VW9ehaDGkiOS+VqlIcZOkMI= diff --git a/mediaapi/routing/routing.go b/mediaapi/routing/routing.go index e392c5711..5bcce1772 100644 --- a/mediaapi/routing/routing.go +++ b/mediaapi/routing/routing.go @@ -83,7 +83,7 @@ func makeDownloadAPI( activeRemoteRequests *types.ActiveRemoteRequests, activeThumbnailGeneration *types.ActiveThumbnailGeneration, ) http.HandlerFunc { - return prometheus.InstrumentHandlerDuration(name, http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) { + return prometheus.InstrumentHandler(name, http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) { req = util.RequestWithLogging(req) // Set common headers returned regardless of the outcome of the request