mirror of
https://github.com/1f349/dendrite.git
synced 2024-12-22 16:24:10 +00:00
Only try to get OTKs if the context isn't done yet
This commit is contained in:
parent
870f9b0c3f
commit
b57fdcc82d
@ -253,9 +253,12 @@ func (rp *RequestPool) OnIncomingSyncRequest(req *http.Request, device *userapi.
|
||||
// We should always try to include OTKs in sync responses, otherwise clients might upload keys
|
||||
// even if that's not required. See also:
|
||||
// https://github.com/matrix-org/synapse/blob/29f06704b8871a44926f7c99e73cf4a978fb8e81/synapse/rest/client/sync.py#L276-L281
|
||||
err = internal.DeviceOTKCounts(syncReq.Context, rp.keyAPI, syncReq.Device.UserID, syncReq.Device.ID, syncReq.Response)
|
||||
if err != nil {
|
||||
syncReq.Log.WithError(err).Error("failed to get OTK counts")
|
||||
// Only try to get OTKs if the context isn't already done.
|
||||
if syncReq.Context.Err() == nil {
|
||||
err = internal.DeviceOTKCounts(syncReq.Context, rp.keyAPI, syncReq.Device.UserID, syncReq.Device.ID, syncReq.Response)
|
||||
if err != nil && err != context.Canceled {
|
||||
syncReq.Log.WithError(err).Warn("failed to get OTK counts")
|
||||
}
|
||||
}
|
||||
return util.JSONResponse{
|
||||
Code: http.StatusOK,
|
||||
|
Loading…
Reference in New Issue
Block a user