Add SQLite write timeout to reduce "database locked" errors

This allows write requests to queue. I've also documented the one-off change to
enable WAL mode.
This commit is contained in:
Ben Sturmfels 2025-02-21 19:24:04 +11:00
parent 0753538503
commit 7d461a810f
Signed by: bsturmfels
GPG key ID: 023C05E2C9C068F0

View file

@ -20,6 +20,13 @@ DATABASES = {
'default': {
'NAME': '/var/lib/www/database/conservancy-website.sqlite3',
'ENGINE': 'django.db.backends.sqlite3',
# WAL mode allows concurrent reading and writing. It is enabled permanently with:
# sudo -u www-data sqlite3 conservancy-website.sqlite3 'PRAGMA journal_mode=WAL;'
'OPTIONS': {
# Reduce the incidence of "database locked" errors by allowing write
# requests to be queued for some seconds.
'timeout': 5,
},
}
}