Revert "Perform server key API operations using new context"

This reverts commit 02172223f5.
This commit is contained in:
Neil Alexander 2020-06-04 14:47:21 +01:00
parent 02172223f5
commit 8c7350d4dd
2 changed files with 4 additions and 8 deletions

View file

@ -70,10 +70,9 @@ func (s *httpServerKeyInternalAPI) FetcherName() string {
}
func (s *httpServerKeyInternalAPI) StoreKeys(
_ context.Context,
ctx context.Context,
results map[gomatrixserverlib.PublicKeyLookupRequest]gomatrixserverlib.PublicKeyLookupResult,
) error {
ctx := context.Background()
request := InputPublicKeysRequest{
Keys: make(map[gomatrixserverlib.PublicKeyLookupRequest]gomatrixserverlib.PublicKeyLookupResult),
}
@ -86,10 +85,9 @@ func (s *httpServerKeyInternalAPI) StoreKeys(
}
func (s *httpServerKeyInternalAPI) FetchKeys(
_ context.Context,
ctx context.Context,
requests map[gomatrixserverlib.PublicKeyLookupRequest]gomatrixserverlib.Timestamp,
) (map[gomatrixserverlib.PublicKeyLookupRequest]gomatrixserverlib.PublicKeyLookupResult, error) {
ctx := context.Background()
result := make(map[gomatrixserverlib.PublicKeyLookupRequest]gomatrixserverlib.PublicKeyLookupResult)
request := QueryPublicKeysRequest{
Requests: make(map[gomatrixserverlib.PublicKeyLookupRequest]gomatrixserverlib.Timestamp),

View file

@ -25,19 +25,17 @@ func (s *ServerKeyAPI) KeyRing() *gomatrixserverlib.KeyRing {
}
func (s *ServerKeyAPI) StoreKeys(
_ context.Context,
ctx context.Context,
results map[gomatrixserverlib.PublicKeyLookupRequest]gomatrixserverlib.PublicKeyLookupResult,
) error {
ctx := context.Background()
// Store any keys that we were given in our database.
return s.OurKeyRing.KeyDatabase.StoreKeys(ctx, results)
}
func (s *ServerKeyAPI) FetchKeys(
_ context.Context,
ctx context.Context,
requests map[gomatrixserverlib.PublicKeyLookupRequest]gomatrixserverlib.Timestamp,
) (map[gomatrixserverlib.PublicKeyLookupRequest]gomatrixserverlib.PublicKeyLookupResult, error) {
ctx := context.Background()
results := map[gomatrixserverlib.PublicKeyLookupRequest]gomatrixserverlib.PublicKeyLookupResult{}
// First consult our local database and see if we have the requested
// keys. These might come from a cache, depending on the database