Skip to content

Commit

Permalink
Switch to using readWriteMutex for lockableQueryMap (cadence-workflow…
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewjdawson2016 authored Mar 11, 2020
1 parent 84c85cd commit b9c6f9b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions service/matching/matchingEngine.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ type (
// RespondQueryTaskCompleted() or through an internal service error causing cadence to be unable to dispatch
// query task to workflow worker.
lockableQueryTaskMap struct {
sync.Mutex
sync.RWMutex
queryTaskMap map[string]chan *queryResult
}

Expand Down Expand Up @@ -829,8 +829,8 @@ func (m *lockableQueryTaskMap) put(key string, value chan *queryResult) {
}

func (m *lockableQueryTaskMap) get(key string) (chan *queryResult, bool) {
m.Lock()
defer m.Unlock()
m.RLock()
defer m.RUnlock()
result, ok := m.queryTaskMap[key]
return result, ok
}
Expand Down

0 comments on commit b9c6f9b

Please sign in to comment.