upgrade github.com/alimy/tryst => v0.9.2

pull/415/head
Michael Li 1 year ago
parent 0994a40d6d
commit 4134faf541
No known key found for this signature in database

@ -7,7 +7,7 @@ require (
github.com/RoaringBitmap/roaring v1.6.0 github.com/RoaringBitmap/roaring v1.6.0
github.com/afocus/captcha v0.0.0-20191010092841-4bd1f21c8868 github.com/afocus/captcha v0.0.0-20191010092841-4bd1f21c8868
github.com/alimy/mir/v4 v4.0.0 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/aliyun/aliyun-oss-go-sdk v2.2.9+incompatible
github.com/allegro/bigcache/v3 v3.1.0 github.com/allegro/bigcache/v3 v3.1.0
github.com/bufbuild/connect-go v1.10.0 github.com/bufbuild/connect-go v1.10.0

@ -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/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 h1:MzGfmoLjjvR69jbZEmpKJO3tUuqB0RGRv1UWPbtukBg=
github.com/alimy/mir/v4 v4.0.0/go.mod h1:d58dBvw2KImcVbAUANrciEV/of0arMNsI9c/5UNCMMc= 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.2 h1:u/YYFtUesKeueKrgkPQvnApQspTKjBam69357DgkAew=
github.com/alimy/tryst v0.9.1/go.mod h1:6FcqEImav7S62em+p+MODh+stt/UPp23HobUOK3XwFY= 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 h1:Sg/2xHwDrioHpxTN6WMiwbXTpUEinBpHsN7mG21Rc2k=
github.com/aliyun/aliyun-oss-go-sdk v2.2.9+incompatible/go.mod h1:T/Aws4fEfogEE9v+HPhhw+CntffsBHJ8nXQCwKr0/g8= 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= github.com/allegro/bigcache/v3 v3.1.0 h1:H2Vp8VOvxcrB91o86fUSVJFqeuz8kpyyB02eH3bSzwk=

@ -118,6 +118,6 @@ type WebCache interface {
} }
type MetricCache interface { type MetricCache interface {
SetEventTempWorkerCount(name string, count int) SetEventTempWorkerCount(name string, count int32)
GetEventTempWorkerCount(name string) int GetEventTempWorkerCount(name string) int32
} }

@ -39,11 +39,11 @@ func (s *simpleEventManager) OnEvent(event Event) {
s.em.OnEvent(event) s.em.OnEvent(event)
} }
func (h *simpleWorkerHook) OnJoin(count int) { func (h *simpleWorkerHook) OnJoin(count int32) {
h.cache.SetEventTempWorkerCount(h.name, count) h.cache.SetEventTempWorkerCount(h.name, count)
} }
func (h *simpleWorkerHook) OnLeave(count int) { func (h *simpleWorkerHook) OnLeave(count int32) {
h.cache.SetEventTempWorkerCount(h.name, count) h.cache.SetEventTempWorkerCount(h.name, count)
} }

@ -16,22 +16,22 @@ var (
) )
type metricCache struct { 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 m.eventTempWorkerCount[name] = count
} }
func (m *metricCache) GetEventTempWorkerCount(name string) int { func (m *metricCache) GetEventTempWorkerCount(name string) int32 {
return m.eventTempWorkerCount[name] return m.eventTempWorkerCount[name]
} }
func NewMetricCache() core.MetricCache { func NewMetricCache() core.MetricCache {
_onceMetricCache.Do(func() { _onceMetricCache.Do(func() {
_metricCache = &metricCache{ _metricCache = &metricCache{
eventTempWorkerCount: make(map[string]int), eventTempWorkerCount: make(map[string]int32),
} }
}) })
return _metricCache return _metricCache

Loading…
Cancel
Save