Skip to content

Commit

Permalink
Avoid logging issues which possibly aren't issues
Browse files Browse the repository at this point in the history
  • Loading branch information
S7evinK committed Nov 10, 2023
1 parent 58af9a2 commit c8f7373
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions keyring.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (

"github.com/matrix-org/gomatrixserverlib/spec"
"github.com/matrix-org/util"
"github.com/sirupsen/logrus"
"golang.org/x/crypto/ed25519"
)

Expand Down Expand Up @@ -271,12 +272,10 @@ func (k KeyRing) VerifyJSONs(ctx context.Context, requests []VerifyJSONRequest)

fetched, err := fetcher.FetchKeys(ctx, keyRequests)
if err != nil {
fetcherLogger.WithError(err).Warn("Failed to request keys from fetcher")
continue
}

if len(fetched) == 0 {
fetcherLogger.Warn("Failed to retrieve any keys")
continue
}

Expand All @@ -290,6 +289,19 @@ func (k KeyRing) VerifyJSONs(ctx context.Context, requests []VerifyJSONRequest)
}
}

// We for some reason failed to fetch keys for some servers
if len(keyRequests) > 0 {
requestedServers := make([]string, 0, len(keyRequests))
for reqs := range keyRequests {
requestedServers = append(requestedServers, string(reqs.ServerName))
}

logger.WithFields(logrus.Fields{
"servers": requestedServers,
"fetchers": len(k.KeyFetchers),
}).Warn("failed to fetch keys for some servers")
}

// Now that we've fetched all of the keys we need, try to check
// if the requests are valid.
k.checkUsingKeys(requests, results, keyIDs, keysFetched)
Expand Down

0 comments on commit c8f7373

Please sign in to comment.