summary refs log tree commit diff
path: root/src/Cache.cpp
diff options
context:
space:
mode:
authorNicolas Werner <nicolas.werner@hotmail.de>2020-12-13 01:27:30 +0100
committerNicolas Werner <nicolas.werner@hotmail.de>2020-12-13 01:29:35 +0100
commit65a4c85ed496176d1bc4d312de6c399b5dd0e305 (patch)
tree9290df72d5f534f6e281760427ebb2e3b79ba1cf /src/Cache.cpp
parentRemove some travis builds (diff)
downloadnheko-65a4c85ed496176d1bc4d312de6c399b5dd0e305.tar.xz
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.
Diffstat (limited to '')
-rw-r--r--src/Cache.cpp2
1 files changed, 1 insertions, 1 deletions
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" +