mirror of https://github.com/knative/pkg.git
Lock before iterating map so that code does not panic on concurrent write (#3280)
Signed-off-by: Sascha Schwarze <schwarzs@de.ibm.com> Co-authored-by: Sascha Schwarze <schwarzs@de.ibm.com> Co-authored-by: Norman Boewing <boewing@de.ibm.com>
This commit is contained in:
parent
487f9df8d3
commit
7bf6febca0
|
|
@ -121,6 +121,10 @@ func (m *queueMetrics) updateUnfinishedWork() {
|
|||
// doesn't seem to have non-hacky ways to reset the summary metrics.
|
||||
var total float64
|
||||
var oldest float64
|
||||
|
||||
m.mu.Lock()
|
||||
defer m.mu.Unlock()
|
||||
|
||||
for _, t := range m.processingStartTimes {
|
||||
age := m.sinceInSeconds(t)
|
||||
total += age
|
||||
|
|
|
|||
Loading…
Reference in New Issue