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.
This commit is contained in:
Nicolas Werner 2023-07-31 17:18:52 +02:00
parent 4f8fce34d5
commit eb0759caf5
No known key found for this signature in database
1 changed files with 1 additions and 5 deletions

View File

@ -182,8 +182,6 @@ class KeyManager {
if (uploaded) { if (uploaded) {
await client.database await client.database
?.markInboundGroupSessionAsUploaded(roomId, sessionId); ?.markInboundGroupSessionAsUploaded(roomId, sessionId);
} else {
_haveKeysToUpload = true;
} }
}); });
final room = client.getRoomById(roomId); final room = client.getRoomById(roomId);
@ -750,7 +748,6 @@ class KeyManager {
} }
bool _isUploadingKeys = false; bool _isUploadingKeys = false;
bool _haveKeysToUpload = true;
Future<void> backgroundTasks() async { Future<void> backgroundTasks() async {
final database = client.database; final database = client.database;
@ -760,12 +757,11 @@ class KeyManager {
} }
_isUploadingKeys = true; _isUploadingKeys = true;
try { try {
if (!_haveKeysToUpload || !(await isCached())) { if (!(await isCached())) {
return; // we can't backup anyways return; // we can't backup anyways
} }
final dbSessions = await database.getInboundGroupSessionsToUpload(); final dbSessions = await database.getInboundGroupSessionsToUpload();
if (dbSessions.isEmpty) { if (dbSessions.isEmpty) {
_haveKeysToUpload = false;
return; // nothing to do return; // nothing to do
} }
final privateKey = final privateKey =