Skip to content

Commit

Permalink
Merge pull request #250 from practo/bugfix-conc-map-write
Browse files Browse the repository at this point in the history
Read also need synchronization
  • Loading branch information
alok87 authored Sep 3, 2021
2 parents aeae0df + e71f99a commit 532d0ee
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pkg/prometheus/prometheus.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,9 @@ func (p *promClient) queryWithRetry(

func (p *promClient) Query(queryString string) (float64, error) {
// return from cache if cache hit
p.mutex.Lock()
lastRun, ok := p.queryLastRun[queryString]
p.mutex.Unlock()
if ok {
if cacheValid(p.queryCacheValidity, lastRun) {
cache, ok := p.queryCache[queryString]
Expand Down

0 comments on commit 532d0ee

Please sign in to comment.