diff options
author | Till <2353100+S7evinK@users.noreply.github.com> | 2022-08-03 18:35:17 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-03 18:35:17 +0200 |
commit | 9fe509b18da997e294813fcc5f46a45b7f6e6784 (patch) | |
tree | eb329616f26d8391a738b3ef2f9ab4994d79fbc7 /keyserver | |
parent | 2250768be16bd0e6b3a6a72b5e55eb3e2ad6e3c6 (diff) |
Fix syncapi shared users query & device lists (#2614)
* Fix query issue, only add "changed" users if we actually share a room
* Avoid log spam if context is done
* Undo changes to filterSharedUsers
* Add logging again..
* Fix SQLite shared users query
* Change query to include invited users
Diffstat (limited to 'keyserver')
-rw-r--r-- | keyserver/internal/internal.go | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/keyserver/internal/internal.go b/keyserver/internal/internal.go index c146b2aa..91f01151 100644 --- a/keyserver/internal/internal.go +++ b/keyserver/internal/internal.go @@ -18,6 +18,7 @@ import ( "bytes" "context" "encoding/json" + "errors" "fmt" "sync" "time" @@ -314,6 +315,11 @@ func (a *KeyInternalAPI) QueryKeys(ctx context.Context, req *api.QueryKeysReques for targetKeyID := range masterKey.Keys { sigMap, err := a.DB.CrossSigningSigsForTarget(ctx, req.UserID, targetUserID, targetKeyID) if err != nil { + // Stop executing the function if the context was canceled/the deadline was exceeded, + // as we can't continue without a valid context. + if errors.Is(err, context.Canceled) || errors.Is(err, context.DeadlineExceeded) { + return + } logrus.WithError(err).Errorf("a.DB.CrossSigningSigsForTarget failed") continue } @@ -335,6 +341,11 @@ func (a *KeyInternalAPI) QueryKeys(ctx context.Context, req *api.QueryKeysReques for targetKeyID, key := range forUserID { sigMap, err := a.DB.CrossSigningSigsForTarget(ctx, req.UserID, targetUserID, gomatrixserverlib.KeyID(targetKeyID)) if err != nil { + // Stop executing the function if the context was canceled/the deadline was exceeded, + // as we can't continue without a valid context. + if errors.Is(err, context.Canceled) || errors.Is(err, context.DeadlineExceeded) { + return + } logrus.WithError(err).Errorf("a.DB.CrossSigningSigsForTarget failed") continue } |