From fa90bba8205cc229ce767c82c809873c0f3bceb1 Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Fri, 26 Sep 2025 19:48:22 +0300 Subject: [PATCH] crypto: don't check otk count if sharing new keys --- crypto/machine.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crypto/machine.go b/crypto/machine.go index ab3e4591..4d2e3880 100644 --- a/crypto/machine.go +++ b/crypto/machine.go @@ -729,7 +729,7 @@ func (mach *OlmMachine) ShareKeys(ctx context.Context, currentOTKCount int) erro start := time.Now() mach.otkUploadLock.Lock() defer mach.otkUploadLock.Unlock() - if mach.lastOTKUpload.Add(1*time.Minute).After(start) || currentOTKCount < 0 { + if mach.lastOTKUpload.Add(1*time.Minute).After(start) || (currentOTKCount < 0 && mach.account.Shared) { log.Debug().Msg("Checking OTK count from server due to suspiciously close share keys requests or negative OTK count") resp, err := mach.Client.UploadKeys(ctx, &mautrix.ReqUploadKeys{}) if err != nil {