X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=futatabi%2Fdb.cpp;h=636b63ea54b8faf5b7d414738ef8775fbdf6a455;hb=3630741c0d8c1d73fb7d888e1eb772e53f117105;hp=75fc6f2c85f1a382519d4d595c1266d120fcf523;hpb=bc3fa9eedf79a34faa2e6bbf57a555bfeb51ec1d;p=nageru diff --git a/futatabi/db.cpp b/futatabi/db.cpp index 75fc6f2..636b63e 100644 --- a/futatabi/db.cpp +++ b/futatabi/db.cpp @@ -15,6 +15,14 @@ DB::DB(const string &filename) exit(1); } + // Set an effectively infinite timeout for waiting for write locks; + // if we get SQLITE_LOCKED, we just exit out, so this is much better. + ret = sqlite3_busy_timeout(db, 3600000); + if (ret != SQLITE_OK) { + fprintf(stderr, "sqlite3_busy_timeout: %s\n", sqlite3_errmsg(db)); + exit(1); + } + sqlite3_exec(db, R"( CREATE TABLE IF NOT EXISTS state (state BLOB); )", @@ -23,7 +31,7 @@ DB::DB(const string &filename) sqlite3_exec(db, "CREATE UNIQUE INDEX only_one_state ON state (1);", nullptr, nullptr, nullptr); // Ignore errors. sqlite3_exec(db, R"( - CREATE TABLE IF NOT EXISTS settings (settings BLOB, uniqifier NOT NULL DEFAULT 1 UNIQUE); + CREATE TABLE IF NOT EXISTS settings (settings BLOB); )", nullptr, nullptr, nullptr); // Ignore errors. @@ -291,13 +299,13 @@ void DB::store_frame_file(const string &filename, size_t size, const vector