From 65a4c85ed496176d1bc4d312de6c399b5dd0e305 Mon Sep 17 00:00:00 2001 From: Nicolas Werner Date: Sun, 13 Dec 2020 01:27:30 +0100 Subject: [PATCH] Don't sync db on every sync This fixes some lag, when Nheko is running, which could affect Nheko and even other applications by excessively calling fsync. This should be fine, since all filesystems seem to guarantee order and in most cases, the modified pages are still written. In the worst case we should only lose the last /sync results or similar. --- src/Cache.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Cache.cpp b/src/Cache.cpp index 97e99700..05c2e486 100644 --- a/src/Cache.cpp +++ b/src/Cache.cpp @@ -189,7 +189,7 @@ Cache::setup() // NOTE(Nico): We may want to use (MDB_MAPASYNC | MDB_WRITEMAP) in the future, but // it can really mess up our database, so we shouldn't. For now, hopefully // NOMETASYNC is fast enough. - env_.open(statePath.toStdString().c_str(), MDB_NOMETASYNC); + env_.open(statePath.toStdString().c_str(), MDB_NOMETASYNC | MDB_NOSYNC); } catch (const lmdb::error &e) { if (e.code() != MDB_VERSION_MISMATCH && e.code() != MDB_INVALID) { throw std::runtime_error("LMDB initialization failed" +