rules: Remove redundant RLock to avoid double RLock (#7183)

Signed-off-by: BurtonQin <bobbqqin@gmail.com>
This commit is contained in:
Anonymous 2020-09-08 01:58:21 +08:00 committed by GitHub
parent 808a14569d
commit 8219b442c8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1109,9 +1109,6 @@ func (m *Manager) Rules() []Rule {
// AlertingRules returns the list of the manager's alerting rules. // AlertingRules returns the list of the manager's alerting rules.
func (m *Manager) AlertingRules() []*AlertingRule { func (m *Manager) AlertingRules() []*AlertingRule {
m.mtx.RLock()
defer m.mtx.RUnlock()
alerts := []*AlertingRule{} alerts := []*AlertingRule{}
for _, rule := range m.Rules() { for _, rule := range m.Rules() {
if alertingRule, ok := rule.(*AlertingRule); ok { if alertingRule, ok := rule.(*AlertingRule); ok {