summary refs log tree commit diff
path: root/src/Cache.cpp
diff options
context:
space:
mode:
authorNicolas Werner <nicolas.werner@hotmail.de>2020-08-25 23:05:20 +0200
committerNicolas Werner <nicolas.werner@hotmail.de>2020-08-25 23:05:31 +0200
commit9f79b855799e8b11f971d2481621a3de344fac4a (patch)
tree27f97b5322081da9d95490df33ce80cd4d2104e5 /src/Cache.cpp
parentBump mtxclient (diff)
downloadnheko-9f79b855799e8b11f971d2481621a3de344fac4a.tar.xz
Speedup db a bit, but loose some crash resiliency
The loss in durability shouldn't matter, if we can just receive the same
events again after a restart
Diffstat (limited to '')
-rw-r--r--src/Cache.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/Cache.cpp b/src/Cache.cpp
index e41ad7ca..2231aaac 100644
--- a/src/Cache.cpp
+++ b/src/Cache.cpp
@@ -168,7 +168,10 @@ Cache::setup()
         }
 
         try {
-                env_.open(statePath.toStdString().c_str());
+                // 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);
         } catch (const lmdb::error &e) {
                 if (e.code() != MDB_VERSION_MISMATCH && e.code() != MDB_INVALID) {
                         throw std::runtime_error("LMDB initialization failed" +