mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-22 11:00:48 +03:00
Only prune old messages every 500 syncs
This commit is contained in:
parent
28adc9dc9b
commit
d6386546b3
1 changed files with 7 additions and 1 deletions
|
@ -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();
|
||||
|
|
Loading…
Reference in a new issue