Skip to content

Free, Open Source, Self-Hosted WhatsApp API Gateway

docs(backup): say the SQLite copy blocks app writes

Yudhi Armyndharis5ba21c1219b6
diff --git a/scripts/backup.sh b/scripts/backup.sh
index 8e87afd44..b45bf58aa 100755
--- a/scripts/backup.sh
+++ b/scripts/backup.sh
@@ -181,8 +181,9 @@ backup_sqlite() {
if command -v sqlite3 >/dev/null 2>&1; then
# The app writes in rollback-journal mode, and a bare .backup gave up on the first lock it met and
# restarted after every outside write, so a busy gateway never got a backup. The read transaction
- # lets the copy finish in one pass (app writes wait for it), the busy timeout waits out a commit,
- # and -init /dev/null keeps the operator's sqlite3 rc file out of the run.
+ # lets the copy finish in one pass, but it blocks every app write until the copy ends, and a write
+ # that outlasts the app's SQLite busy timeout fails. The busy timeout here waits out a commit, and
+ # -init /dev/null keeps the operator's sqlite3 rc file out of the run.
sqlite3 -init /dev/null -cmd ".timeout 30000" "$src" \
"BEGIN" "SELECT count(*) FROM sqlite_master" ".backup '$dest'" "COMMIT" >/dev/null
else