Skip to content

Commit

Permalink
pkg/services: ErrorBuffer.Flush fix race (#998)
Browse files Browse the repository at this point in the history
  • Loading branch information
jmank88 authored Jan 15, 2025
1 parent 0cd7b49 commit 4e61572
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pkg/services/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,12 +208,12 @@ type ErrorBuffer struct {
// Exceeding the cap results in discarding the oldest error
cap int

mu sync.RWMutex
mu sync.Mutex
}

func (eb *ErrorBuffer) Flush() (err error) {
eb.mu.RLock()
defer eb.mu.RUnlock()
eb.mu.Lock()
defer eb.mu.Unlock()
err = errors.Join(eb.buffer...)
eb.buffer = nil
return
Expand Down

0 comments on commit 4e61572

Please sign in to comment.