forked from TrueCloudLab/frostfs-node
[#637] shard/test: Fix data race
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
parent
f8ba60aa0c
commit
c4db8e7690
1 changed files with 7 additions and 3 deletions
|
@ -28,13 +28,17 @@ type metricsStore struct {
|
||||||
errCounter int64
|
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
|
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 {
|
switch {
|
||||||
case delta > 0:
|
case delta > 0:
|
||||||
m.objCounters[objectType] += uint64(delta)
|
m.objCounters[objectType] += uint64(delta)
|
||||||
|
|
Loading…
Reference in a new issue