types: refactor *memMarker.Count method
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
This commit is contained in:
parent
588b4dd17b
commit
27e99e9e35
|
@ -128,14 +128,14 @@ func (m *memMarker) registerMetrics(r prometheus.Registerer) {
|
|||
|
||||
// Count implements Marker.
|
||||
func (m *memMarker) Count(states ...AlertState) int {
|
||||
count := 0
|
||||
|
||||
m.mtx.RLock()
|
||||
defer m.mtx.RUnlock()
|
||||
|
||||
if len(states) == 0 {
|
||||
count = len(m.m)
|
||||
} else {
|
||||
return len(m.m)
|
||||
}
|
||||
|
||||
var count int
|
||||
for _, status := range m.m {
|
||||
for _, state := range states {
|
||||
if status.State == state {
|
||||
|
@ -143,7 +143,6 @@ func (m *memMarker) Count(states ...AlertState) int {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return count
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue