From eb0759caf5ecfb511438aa9aa3924632284772f3 Mon Sep 17 00:00:00 2001 From: Nicolas Werner Date: Mon, 31 Jul 2023 17:18:52 +0200 Subject: [PATCH] fix: fix upload of old session after reset Otherwise we would need to wait for a new inbound session to upload them. It might increase disk usage a bit every 10 minutes. --- lib/encryption/key_manager.dart | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/lib/encryption/key_manager.dart b/lib/encryption/key_manager.dart index 2aefd18d..435d1667 100644 --- a/lib/encryption/key_manager.dart +++ b/lib/encryption/key_manager.dart @@ -182,8 +182,6 @@ class KeyManager { if (uploaded) { await client.database ?.markInboundGroupSessionAsUploaded(roomId, sessionId); - } else { - _haveKeysToUpload = true; } }); final room = client.getRoomById(roomId); @@ -750,7 +748,6 @@ class KeyManager { } bool _isUploadingKeys = false; - bool _haveKeysToUpload = true; Future backgroundTasks() async { final database = client.database; @@ -760,12 +757,11 @@ class KeyManager { } _isUploadingKeys = true; try { - if (!_haveKeysToUpload || !(await isCached())) { + if (!(await isCached())) { return; // we can't backup anyways } final dbSessions = await database.getInboundGroupSessionsToUpload(); if (dbSessions.isEmpty) { - _haveKeysToUpload = false; return; // nothing to do } final privateKey =