Skip to content

Commit

Permalink
fix(server): panic on concurrent read write (#3253)
Browse files Browse the repository at this point in the history
  • Loading branch information
schoren authored Oct 12, 2023
1 parent feee677 commit 187959a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions server/traces/caching.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,16 @@ func resetCache() {
}

func (c spanCache) Get(key string) (*Span, bool) {
cacheMutex.Lock()
defer cacheMutex.Unlock()

value, ok := c[key]
return value, ok
}

func (c spanCache) Set(key string, value *Span) {
cacheMutex.Lock()
defer cacheMutex.Unlock()

c[key] = value
}

0 comments on commit 187959a

Please sign in to comment.