|
|
@ -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
|
|
|
|