Fix concurrent map access. (#4127)
https://github.com/livekit/livekit/issues/4126
This commit is contained in:
+2
-2
@@ -1846,9 +1846,9 @@ func (r *Room) createAgentDispatch(dispatch *livekit.AgentDispatch) (*agentDispa
|
|||||||
}
|
}
|
||||||
ad := newAgentDispatch(dispatch)
|
ad := newAgentDispatch(dispatch)
|
||||||
|
|
||||||
r.lock.RLock()
|
r.lock.Lock()
|
||||||
r.agentDispatches[ad.Id] = ad
|
r.agentDispatches[ad.Id] = ad
|
||||||
r.lock.RUnlock()
|
r.lock.Unlock()
|
||||||
if r.agentStore != nil {
|
if r.agentStore != nil {
|
||||||
err := r.agentStore.StoreAgentDispatch(context.Background(), ad.AgentDispatch)
|
err := r.agentStore.StoreAgentDispatch(context.Background(), ad.AgentDispatch)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user