From 4134faf541768df057f05bd978747b438c7f9b4b Mon Sep 17 00:00:00 2001 From: Michael Li Date: Tue, 17 Oct 2023 12:51:08 +0800 Subject: [PATCH] upgrade github.com/alimy/tryst => v0.9.2 --- go.mod | 2 +- go.sum | 4 ++-- internal/core/cache.go | 4 ++-- internal/events/events_tryst.go | 4 ++-- internal/metrics/statistics/cache.go | 8 ++++---- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/go.mod b/go.mod index 6439952d..2703d5a8 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/RoaringBitmap/roaring v1.6.0 github.com/afocus/captcha v0.0.0-20191010092841-4bd1f21c8868 github.com/alimy/mir/v4 v4.0.0 - github.com/alimy/tryst v0.9.1 + github.com/alimy/tryst v0.9.2 github.com/aliyun/aliyun-oss-go-sdk v2.2.9+incompatible github.com/allegro/bigcache/v3 v3.1.0 github.com/bufbuild/connect-go v1.10.0 diff --git a/go.sum b/go.sum index ad7ba6fe..2fa30cc6 100644 --- a/go.sum +++ b/go.sum @@ -127,8 +127,8 @@ github.com/alexflint/go-filemutex v0.0.0-20171022225611-72bdc8eae2ae/go.mod h1:C github.com/alexflint/go-filemutex v1.1.0/go.mod h1:7P4iRhttt/nUvUOrYIhcpMzv2G6CY9UnI16Z+UJqRyk= github.com/alimy/mir/v4 v4.0.0 h1:MzGfmoLjjvR69jbZEmpKJO3tUuqB0RGRv1UWPbtukBg= github.com/alimy/mir/v4 v4.0.0/go.mod h1:d58dBvw2KImcVbAUANrciEV/of0arMNsI9c/5UNCMMc= -github.com/alimy/tryst v0.9.1 h1:EnsvdS/kvUJ7IybrjFdBMGkAiHRTXx0bScdZSUhZb4w= -github.com/alimy/tryst v0.9.1/go.mod h1:6FcqEImav7S62em+p+MODh+stt/UPp23HobUOK3XwFY= +github.com/alimy/tryst v0.9.2 h1:u/YYFtUesKeueKrgkPQvnApQspTKjBam69357DgkAew= +github.com/alimy/tryst v0.9.2/go.mod h1:6FcqEImav7S62em+p+MODh+stt/UPp23HobUOK3XwFY= github.com/aliyun/aliyun-oss-go-sdk v2.2.9+incompatible h1:Sg/2xHwDrioHpxTN6WMiwbXTpUEinBpHsN7mG21Rc2k= github.com/aliyun/aliyun-oss-go-sdk v2.2.9+incompatible/go.mod h1:T/Aws4fEfogEE9v+HPhhw+CntffsBHJ8nXQCwKr0/g8= github.com/allegro/bigcache/v3 v3.1.0 h1:H2Vp8VOvxcrB91o86fUSVJFqeuz8kpyyB02eH3bSzwk= diff --git a/internal/core/cache.go b/internal/core/cache.go index d9947405..f2fa5d3f 100644 --- a/internal/core/cache.go +++ b/internal/core/cache.go @@ -118,6 +118,6 @@ type WebCache interface { } type MetricCache interface { - SetEventTempWorkerCount(name string, count int) - GetEventTempWorkerCount(name string) int + SetEventTempWorkerCount(name string, count int32) + GetEventTempWorkerCount(name string) int32 } diff --git a/internal/events/events_tryst.go b/internal/events/events_tryst.go index 777b0800..b08a4978 100644 --- a/internal/events/events_tryst.go +++ b/internal/events/events_tryst.go @@ -39,11 +39,11 @@ func (s *simpleEventManager) OnEvent(event Event) { s.em.OnEvent(event) } -func (h *simpleWorkerHook) OnJoin(count int) { +func (h *simpleWorkerHook) OnJoin(count int32) { h.cache.SetEventTempWorkerCount(h.name, count) } -func (h *simpleWorkerHook) OnLeave(count int) { +func (h *simpleWorkerHook) OnLeave(count int32) { h.cache.SetEventTempWorkerCount(h.name, count) } diff --git a/internal/metrics/statistics/cache.go b/internal/metrics/statistics/cache.go index 4ce21f82..bec47c39 100644 --- a/internal/metrics/statistics/cache.go +++ b/internal/metrics/statistics/cache.go @@ -16,22 +16,22 @@ var ( ) type metricCache struct { - eventTempWorkerCount map[string]int + eventTempWorkerCount map[string]int32 } -func (m *metricCache) SetEventTempWorkerCount(name string, count int) { +func (m *metricCache) SetEventTempWorkerCount(name string, count int32) { // 直接赋值,不需要加锁,因为这仅仅是一个统计信息 m.eventTempWorkerCount[name] = count } -func (m *metricCache) GetEventTempWorkerCount(name string) int { +func (m *metricCache) GetEventTempWorkerCount(name string) int32 { return m.eventTempWorkerCount[name] } func NewMetricCache() core.MetricCache { _onceMetricCache.Do(func() { _metricCache = &metricCache{ - eventTempWorkerCount: make(map[string]int), + eventTempWorkerCount: make(map[string]int32), } }) return _metricCache