From f016caa51300f7b127950b5c8e81463d3fbdeafc Mon Sep 17 00:00:00 2001 From: Joseph Benguira Date: Sun, 31 Jul 2022 18:51:53 +0300 Subject: [PATCH 1/4] Avoid error "SQLITE_BUSY: database is locked" Avoid error "SQLITE_BUSY: database is locked" by allowing SQLITE to wait up to 5 seconds to do a write --- server/database.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/server/database.js b/server/database.js index 00fd48d9..b58daf87 100644 --- a/server/database.js +++ b/server/database.js @@ -146,6 +146,9 @@ class Database { } await R.exec("PRAGMA cache_size = -12000"); await R.exec("PRAGMA auto_vacuum = FULL"); + + //Avoid error "SQLITE_BUSY: database is locked" by allowing SQLITE to wait up to 5 seconds to do a write + await R.exec("PRAGMA busy_timeout = 5000;"); // This ensures that an operating system crash or power failure will not corrupt the database. // FULL synchronous is very safe, but it is also slower. From 82b9bfc5a0a4fdc6492bfedbd11a0bd7bfa10b38 Mon Sep 17 00:00:00 2001 From: Joseph Benguira Date: Sun, 31 Jul 2022 18:59:02 +0300 Subject: [PATCH 2/4] fixed Trailing spaces not allowed lint issue --- server/database.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/database.js b/server/database.js index b58daf87..4c374ca6 100644 --- a/server/database.js +++ b/server/database.js @@ -146,7 +146,7 @@ class Database { } await R.exec("PRAGMA cache_size = -12000"); await R.exec("PRAGMA auto_vacuum = FULL"); - + //Avoid error "SQLITE_BUSY: database is locked" by allowing SQLITE to wait up to 5 seconds to do a write await R.exec("PRAGMA busy_timeout = 5000;"); From 71d62ee1510a5c336d3d22901e231814bba0187f Mon Sep 17 00:00:00 2001 From: Joseph Benguira Date: Sun, 31 Jul 2022 19:00:19 +0300 Subject: [PATCH 3/4] removed ; after the PRAGMA command --- server/database.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/database.js b/server/database.js index 4c374ca6..5f87352b 100644 --- a/server/database.js +++ b/server/database.js @@ -148,7 +148,7 @@ class Database { await R.exec("PRAGMA auto_vacuum = FULL"); //Avoid error "SQLITE_BUSY: database is locked" by allowing SQLITE to wait up to 5 seconds to do a write - await R.exec("PRAGMA busy_timeout = 5000;"); + await R.exec("PRAGMA busy_timeout = 5000"); // This ensures that an operating system crash or power failure will not corrupt the database. // FULL synchronous is very safe, but it is also slower. From d6a113396a0a3512c7ac5975eaafb5fba2c46a36 Mon Sep 17 00:00:00 2001 From: Joseph Benguira Date: Mon, 1 Aug 2022 13:18:19 +0300 Subject: [PATCH 4/4] Update server/database.js Co-authored-by: Adam Stachowicz --- server/database.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/database.js b/server/database.js index 5f87352b..b4865b1f 100644 --- a/server/database.js +++ b/server/database.js @@ -147,7 +147,7 @@ class Database { await R.exec("PRAGMA cache_size = -12000"); await R.exec("PRAGMA auto_vacuum = FULL"); - //Avoid error "SQLITE_BUSY: database is locked" by allowing SQLITE to wait up to 5 seconds to do a write + // Avoid error "SQLITE_BUSY: database is locked" by allowing SQLITE to wait up to 5 seconds to do a write await R.exec("PRAGMA busy_timeout = 5000"); // This ensures that an operating system crash or power failure will not corrupt the database.