We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent cd4aaef commit b234e22Copy full SHA for b234e22
1 file changed
internal/certificatetransparency/logmetrics.go
@@ -80,8 +80,9 @@ func (m *LogMetrics) Init(operator, url string) {
80
81
// Get the metric for a given operator and ct url.
82
func (m *LogMetrics) Get(operator, url string) int64 {
83
- m.mutex.RLock()
84
- defer m.mutex.RUnlock()
+ // Despite this being a getter, we still need to fully lock the mutex because we might modify the map if the requested operator does not exist.
+ m.mutex.Lock()
85
+ defer m.mutex.Unlock()
86
87
if _, ok := m.metrics[operator]; !ok {
88
m.metrics[operator] = make(OperatorMetric)
0 commit comments