Only prune old messages every 500 syncs
This commit is contained in:
parent
28adc9dc9b
commit
d6386546b3
@ -1000,7 +1000,13 @@ ChatPage::trySync()
|
|||||||
|
|
||||||
emit syncTags(cache::roomTagUpdates(res));
|
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) {
|
} catch (const lmdb::map_full_error &e) {
|
||||||
nhlog::db()->error("lmdb is full: {}", e.what());
|
nhlog::db()->error("lmdb is full: {}", e.what());
|
||||||
cache::deleteOldData();
|
cache::deleteOldData();
|
||||||
|
Loading…
Reference in New Issue
Block a user