[#637] shard/test: Fix data race
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
parent
c9e3c9956e
commit
1ced0e936f
1 changed files with 7 additions and 3 deletions
|
@ -28,13 +28,17 @@ type metricsStore struct {
|
|||
errCounter int64
|
||||
}
|
||||
|
||||
func (m metricsStore) SetShardID(_ string) {}
|
||||
func (m *metricsStore) SetShardID(_ string) {}
|
||||
|
||||
func (m metricsStore) SetObjectCounter(objectType string, v uint64) {
|
||||
func (m *metricsStore) SetObjectCounter(objectType string, v uint64) {
|
||||
m.mtx.Lock()
|
||||
defer m.mtx.Unlock()
|
||||
m.objCounters[objectType] = v
|
||||
}
|
||||
|
||||
func (m metricsStore) AddToObjectCounter(objectType string, delta int) {
|
||||
func (m *metricsStore) AddToObjectCounter(objectType string, delta int) {
|
||||
m.mtx.Lock()
|
||||
defer m.mtx.Unlock()
|
||||
switch {
|
||||
case delta > 0:
|
||||
m.objCounters[objectType] += uint64(delta)
|
||||
|
|
Loading…
Reference in a new issue