Skip to content

Commit

Permalink
fix(externalclock): mutex around access to map
Browse files Browse the repository at this point in the history
Avoids data race errors when used in unit tests.
  • Loading branch information
Edholm committed Nov 10, 2022
1 parent 4149187 commit f3fbb76
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions externalclock/clock.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ func (g *Clock) SetTimestamp(t time.Time) {
}

func (g *Clock) NumberOfTriggers() int {
g.tickerMutex.RLock()
defer g.tickerMutex.RUnlock()
return len(g.tickers)
}

Expand Down

0 comments on commit f3fbb76

Please sign in to comment.