1 files changed, 7 insertions, 1 deletions
diff --git a/src/ChatPage.cpp b/src/ChatPage.cpp
index 61050c35..37d1354b 100644
--- a/src/ChatPage.cpp
+++ b/src/ChatPage.cpp
@@ -1000,7 +1000,13 @@ ChatPage::trySync()
emit syncTags(cache::roomTagUpdates(res));
- cache::deleteOldData();
+ // if we process a lot of syncs (1 every 200ms), this means we clean the
+ // db every 100s
+ static int syncCounter = 0;
+ if (syncCounter++ >= 500) {
+ cache::deleteOldData();
+ syncCounter = 0;
+ }
} catch (const lmdb::map_full_error &e) {
nhlog::db()->error("lmdb is full: {}", e.what());
cache::deleteOldData();
|