This commit is contained in:
Kegan Dougal 2020-07-23 16:04:18 +01:00
parent 21ec1709e0
commit 0518309586
2 changed files with 7 additions and 4 deletions

View file

@ -292,7 +292,10 @@ func (a *KeyInternalAPI) uploadDeviceKeys(ctx context.Context, req *api.PerformU
} }
return return
} }
a.emitDeviceKeyChanges(existingKeys, keysToStore) err := a.emitDeviceKeyChanges(existingKeys, keysToStore)
if err != nil {
util.GetLogger(ctx).Errorf("Failed to emitDeviceKeyChanges: %s", err)
}
} }
func (a *KeyInternalAPI) uploadOneTimeKeys(ctx context.Context, req *api.PerformUploadKeysRequest, res *api.PerformUploadKeysResponse) { func (a *KeyInternalAPI) uploadOneTimeKeys(ctx context.Context, req *api.PerformUploadKeysRequest, res *api.PerformUploadKeysResponse) {
@ -334,7 +337,7 @@ func (a *KeyInternalAPI) uploadOneTimeKeys(ctx context.Context, req *api.Perform
} }
func (a *KeyInternalAPI) emitDeviceKeyChanges(existing, new []api.DeviceKeys) { func (a *KeyInternalAPI) emitDeviceKeyChanges(existing, new []api.DeviceKeys) error {
// find keys in new that are not in existing // find keys in new that are not in existing
var keysAdded []api.DeviceKeys var keysAdded []api.DeviceKeys
for _, newKey := range new { for _, newKey := range new {
@ -349,5 +352,5 @@ func (a *KeyInternalAPI) emitDeviceKeyChanges(existing, new []api.DeviceKeys) {
keysAdded = append(keysAdded, newKey) keysAdded = append(keysAdded, newKey)
} }
} }
a.Producer.ProduceKeyChanges(keysAdded) return a.Producer.ProduceKeyChanges(keysAdded)
} }

View file

@ -34,7 +34,7 @@ type OutputKeyChangeEventConsumer struct {
db storage.Database db storage.Database
serverName gomatrixserverlib.ServerName // our server name serverName gomatrixserverlib.ServerName // our server name
currentStateAPI currentstateAPI.CurrentStateInternalAPI currentStateAPI currentstateAPI.CurrentStateInternalAPI
keyAPI api.KeyInternalAPI // keyAPI api.KeyInternalAPI
} }
// NewOutputKeyChangeEventConsumer creates a new OutputKeyChangeEventConsumer. // NewOutputKeyChangeEventConsumer creates a new OutputKeyChangeEventConsumer.