Skip to content

Commit

Permalink
Make device key updates less verbose in the logs on cancelled contexts
Browse files Browse the repository at this point in the history
  • Loading branch information
neilalexander committed Apr 11, 2024
1 parent 69aea47 commit ac380fe
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions userapi/internal/cross_signing.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"context"
"crypto/ed25519"
"database/sql"
"errors"
"fmt"
"strings"

Expand Down Expand Up @@ -466,6 +467,9 @@ func (a *UserInternalAPI) crossSigningKeysFromDatabase(
for targetUserID := range req.UserToDevices {
keys, err := a.KeyDatabase.CrossSigningKeysForUser(ctx, targetUserID)
if err != nil {
if errors.Is(err, context.Canceled) {
return
}
logrus.WithError(err).Errorf("Failed to get cross-signing keys for user %q", targetUserID)
continue
}
Expand Down
6 changes: 6 additions & 0 deletions userapi/internal/key_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -531,6 +531,9 @@ func (a *UserInternalAPI) queryRemoteKeysOnServer(
for userID := range userIDsForAllDevices {
err := a.Updater.ManualUpdate(context.Background(), spec.ServerName(serverName), userID)
if err != nil {
if errors.Is(err, context.Canceled) {
return
}
logrus.WithFields(logrus.Fields{
logrus.ErrorKey: err,
"user_id": userID,
Expand All @@ -544,6 +547,9 @@ func (a *UserInternalAPI) queryRemoteKeysOnServer(
// user so the fact that we're populating all devices here isn't a problem so long as we have devices.
err = a.populateResponseWithDeviceKeysFromDatabase(ctx, res, respMu, userID, nil)
if err != nil {
if errors.Is(err, context.Canceled) {
return
}
logrus.WithFields(logrus.Fields{
logrus.ErrorKey: err,
"user_id": userID,
Expand Down

0 comments on commit ac380fe

Please sign in to comment.