summary refs log tree commit diff
diff options
context:
space:
mode:
authorNicolas Werner <nicolas.werner@hotmail.de>2020-04-26 11:29:05 +0200
committerNicolas Werner <nicolas.werner@hotmail.de>2020-04-26 11:29:05 +0200
commitd6386546b38cec9ca83f8d85c90f71e84165028d (patch)
tree00f3db9896c2ad554b95fbf5a73ea3942cf582a8
parentRespect exif rotation of images (diff)
downloadnheko-d6386546b38cec9ca83f8d85c90f71e84165028d.tar.xz
Only prune old messages every 500 syncs
-rw-r--r--src/ChatPage.cpp8
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();