]> git.sesse.net Git - nageru/commitdiff
Speed up the database writes a bit, especially when I/O is busy.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Tue, 13 Nov 2018 23:45:32 +0000 (00:45 +0100)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Sun, 25 Nov 2018 22:36:26 +0000 (23:36 +0100)
db.cpp

diff --git a/db.cpp b/db.cpp
index 9b0de352fda7bafb3ae8c107181325bdefca7508..c3e647cf46343885360c58007da9d970aabe80af 100644 (file)
--- a/db.cpp
+++ b/db.cpp
@@ -15,6 +15,9 @@ DB::DB(const std::string &filename)
        sqlite3_exec(db, R"(
                CREATE TABLE IF NOT EXISTS state (state BLOB);
        )", nullptr, nullptr, nullptr);  // Ignore errors.
+
+       sqlite3_exec(db, "PRAGMA journal_mode=WAL", nullptr, nullptr, nullptr);  // Ignore errors.
+       sqlite3_exec(db, "PRAGMA synchronous=NORMAL", nullptr, nullptr, nullptr);  // Ignore errors.
 }
 
 StateProto DB::get_state()