Skip to content

Commit

Permalink
Code review
Browse files Browse the repository at this point in the history
Signed-off-by: Nick Pillitteri <[email protected]>
  • Loading branch information
56quarters committed Apr 5, 2024
1 parent 827df5b commit 564e057
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions internal/component/mimir/rules/kubernetes/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ type eventProcessor struct {
logger log.Logger

currentState kubernetes.RuleGroupsByNamespace
currentStateMtx sync.Mutex
currentStateMtx sync.RWMutex
}

func (e *eventProcessor) run(ctx context.Context) {
Expand Down Expand Up @@ -237,8 +237,8 @@ func (e *eventProcessor) applyChanges(ctx context.Context, namespace string, dif

// getMimirState returns the cached Mimir ruler state, rule groups indexed by Mimir namespace.
func (e *eventProcessor) getMimirState() kubernetes.RuleGroupsByNamespace {
e.currentStateMtx.Lock()
defer e.currentStateMtx.Unlock()
e.currentStateMtx.RLock()
defer e.currentStateMtx.RUnlock()

out := make(kubernetes.RuleGroupsByNamespace, len(e.currentState))
for ns, groups := range e.currentState {
Expand Down

0 comments on commit 564e057

Please sign in to comment.