mirror of
https://github.com/matrix-org/dendrite
synced 2024-12-14 07:12:53 +00:00
Mutex protect query keys response (#2812)
This commit is contained in:
parent
b58c9bb094
commit
9041491201
1 changed files with 7 additions and 1 deletions
|
@ -472,7 +472,9 @@ func (a *KeyInternalAPI) queryRemoteKeys(
|
||||||
close(resultCh)
|
close(resultCh)
|
||||||
}()
|
}()
|
||||||
|
|
||||||
for result := range resultCh {
|
processResult := func(result *gomatrixserverlib.RespQueryKeys) {
|
||||||
|
respMu.Lock()
|
||||||
|
defer respMu.Unlock()
|
||||||
for userID, nest := range result.DeviceKeys {
|
for userID, nest := range result.DeviceKeys {
|
||||||
res.DeviceKeys[userID] = make(map[string]json.RawMessage)
|
res.DeviceKeys[userID] = make(map[string]json.RawMessage)
|
||||||
for deviceID, deviceKey := range nest {
|
for deviceID, deviceKey := range nest {
|
||||||
|
@ -495,6 +497,10 @@ func (a *KeyInternalAPI) queryRemoteKeys(
|
||||||
// TODO: do we want to persist these somewhere now
|
// TODO: do we want to persist these somewhere now
|
||||||
// that we have fetched them?
|
// that we have fetched them?
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for result := range resultCh {
|
||||||
|
processResult(result)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *KeyInternalAPI) queryRemoteKeysOnServer(
|
func (a *KeyInternalAPI) queryRemoteKeysOnServer(
|
||||||
|
|
Loading…
Reference in a new issue