From 332fe5f4d49bfe730d49ab04daf49cb3cc6b6c8d Mon Sep 17 00:00:00 2001 From: Evstigneev Denis Date: Mon, 14 Oct 2024 18:56:37 +0300 Subject: [PATCH] fix deps --- go.mod | 2 +- go.sum | 14 ++------------ stats.go | 23 ++++++++++------------- 3 files changed, 13 insertions(+), 26 deletions(-) diff --git a/go.mod b/go.mod index 00e5f52..bcdd999 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.22 toolchain go1.22.4 require ( - github.com/redis/go-redis/extra/rediscmd/v9 v9.5.3 + github.com/redis/go-redis/extra/rediscmd/v9 v9.6.2 github.com/redis/go-redis/v9 v9.6.2 go.unistack.org/micro/v3 v3.10.97 ) diff --git a/go.sum b/go.sum index 6b373a1..78c91f0 100644 --- a/go.sum +++ b/go.sum @@ -1,29 +1,19 @@ -github.com/bsm/ginkgo/v2 v2.7.0/go.mod h1:AiKlXPm7ItEHNc/2+OkrNG4E0ITzojb9/xWzvQ9XZ9w= github.com/bsm/ginkgo/v2 v2.12.0 h1:Ny8MWAHyOepLGlLKYmXG4IEkioBysk6GpaRTLC8zwWs= github.com/bsm/ginkgo/v2 v2.12.0/go.mod h1:SwYbGRRDovPVboqFv0tPTcG1sN61LM1Z4ARdbAV9g4c= -github.com/bsm/gomega v1.26.0/go.mod h1:JyEr/xRbxbtgWNi8tIEVPUYZ5Dzef52k01W3YH0H+O0= github.com/bsm/gomega v1.27.10 h1:yeMWxP2pV2fG3FgAODIY8EiRE3dy0aeFYt4l7wh6yKA= github.com/bsm/gomega v1.27.10/go.mod h1:JyEr/xRbxbtgWNi8tIEVPUYZ5Dzef52k01W3YH0H+O0= -github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78= github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/redis/go-redis/extra/rediscmd/v9 v9.0.5 h1:EaDatTxkdHG+U3Bk4EUr+DZ7fOGwTfezUiUJMaIcaho= -github.com/redis/go-redis/extra/rediscmd/v9 v9.0.5/go.mod h1:fyalQWdtzDBECAQFBJuQe5bzQ02jGd5Qcbgb97Flm7U= -github.com/redis/go-redis/extra/rediscmd/v9 v9.5.3 h1:1/BDligzCa40GTllkDnY3Y5DTHuKCONbB2JcRyIfl20= -github.com/redis/go-redis/extra/rediscmd/v9 v9.5.3/go.mod h1:3dZmcLn3Qw6FLlWASn1g4y+YO9ycEFUOM+bhBmzLVKQ= -github.com/redis/go-redis/v9 v9.0.5/go.mod h1:WqMKv5vnQbRuZstUwxQI195wHy+t4PuXDOjzMvcuQHk= -github.com/redis/go-redis/v9 v9.6.1 h1:HHDteefn6ZkTtY5fGUE8tj8uy85AHk6zP7CpzIAM0y4= -github.com/redis/go-redis/v9 v9.6.1/go.mod h1:0C0c6ycQsdpVNQpxb1njEQIqkx5UcsM8FJCQLgE9+RA= +github.com/redis/go-redis/extra/rediscmd/v9 v9.6.2 h1:oBlErygFka9FAVfowzW7sRUfB7n31YX0aFzfaOflM3w= +github.com/redis/go-redis/extra/rediscmd/v9 v9.6.2/go.mod h1:jYLUE5tC8UsFnpSclhEjZlFLMMtHH4jTfFMnshNWkoo= github.com/redis/go-redis/v9 v9.6.2 h1:w0uvkRbc9KpgD98zcvo5IrVUsn0lXpRMuhNgiHDJzdk= github.com/redis/go-redis/v9 v9.6.2/go.mod h1:0C0c6ycQsdpVNQpxb1njEQIqkx5UcsM8FJCQLgE9+RA= go.unistack.org/micro-proto/v3 v3.4.1 h1:UTjLSRz2YZuaHk9iSlVqqsA50JQNAEK2ZFboGqtEa9Q= go.unistack.org/micro-proto/v3 v3.4.1/go.mod h1:okx/cnOhzuCX0ggl/vToatbCupi0O44diiiLLsZ93Zo= -go.unistack.org/micro/v3 v3.10.96 h1:njukb0DlXOJspX5mLSwcP7+cVSg/8Fy+6++mYkOpY2A= -go.unistack.org/micro/v3 v3.10.96/go.mod h1:YzMldzHN9Ei+zy5t/Psu7RUWDZwUfrNYiStSQtTz90g= go.unistack.org/micro/v3 v3.10.97 h1:8l7fv+i06/PjPrBBhRC/ZQkWGIOuHPg3jJN0vktYE78= go.unistack.org/micro/v3 v3.10.97/go.mod h1:YzMldzHN9Ei+zy5t/Psu7RUWDZwUfrNYiStSQtTz90g= google.golang.org/protobuf v1.35.1 h1:m3LfL6/Ca+fqnjnlqQXNpFPABW1UD7mjh8KO2mKFytA= diff --git a/stats.go b/stats.go index 3aeba4c..4248d12 100644 --- a/stats.go +++ b/stats.go @@ -33,20 +33,17 @@ func (r *Store) statsMeter() { ticker := time.NewTicker(meter.DefaultMeterStatsInterval) defer ticker.Stop() - for { - select { - case <-ticker.C: - if st == nil { - return - } - stats := st.PoolStats() - r.opts.Meter.Counter(PoolHitsTotal).Set(uint64(stats.Hits)) - r.opts.Meter.Counter(PoolMissesTotal).Set(uint64(stats.Misses)) - r.opts.Meter.Counter(PoolTimeoutTotal).Set(uint64(stats.Timeouts)) - r.opts.Meter.Counter(PoolConnTotalCurrent).Set(uint64(stats.TotalConns)) - r.opts.Meter.Counter(PoolConnIdleCurrent).Set(uint64(stats.IdleConns)) - r.opts.Meter.Counter(PoolConnStaleTotal).Set(uint64(stats.StaleConns)) + for _ = range ticker.C { + if st == nil { + return } + stats := st.PoolStats() + r.opts.Meter.Counter(PoolHitsTotal).Set(uint64(stats.Hits)) + r.opts.Meter.Counter(PoolMissesTotal).Set(uint64(stats.Misses)) + r.opts.Meter.Counter(PoolTimeoutTotal).Set(uint64(stats.Timeouts)) + r.opts.Meter.Counter(PoolConnTotalCurrent).Set(uint64(stats.TotalConns)) + r.opts.Meter.Counter(PoolConnIdleCurrent).Set(uint64(stats.IdleConns)) + r.opts.Meter.Counter(PoolConnStaleTotal).Set(uint64(stats.StaleConns)) } }() }