Fix concurrent map access. (#4127)

https://github.com/livekit/livekit/issues/4126
This commit is contained in:
Raja Subramanian
2025-12-05 10:48:10 +05:30
committed by GitHub
parent 14446b1cc1
commit 7c1a0fab7c
+2 -2
View File
@@ -1846,9 +1846,9 @@ func (r *Room) createAgentDispatch(dispatch *livekit.AgentDispatch) (*agentDispa
}
ad := newAgentDispatch(dispatch)
r.lock.RLock()
r.lock.Lock()
r.agentDispatches[ad.Id] = ad
r.lock.RUnlock()
r.lock.Unlock()
if r.agentStore != nil {
err := r.agentStore.StoreAgentDispatch(context.Background(), ad.AgentDispatch)
if err != nil {