Skip to content

Commit

Permalink
Add Missing Read Lock for Value to Fix Data Race
Browse files Browse the repository at this point in the history
Signed-off-by: Shivam Kumar <kumar.shivam.jarvis@gmail.com>
  • Loading branch information
ShivamKumar2002 committed Nov 28, 2023
1 parent d18a36d commit 1d8be58
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions timedmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ func (tm *TimedMap) GetValue(key interface{}) interface{} {
if v == nil {
return nil
}
tm.mtx.RLock()
defer tm.mtx.RUnlock()
return v.value
}

Expand Down

0 comments on commit 1d8be58

Please sign in to comment.