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:
parent
0753538503
commit
7d461a810f
1 changed files with 7 additions and 0 deletions
|
@ -20,6 +20,13 @@ DATABASES = {
|
||||||
'default': {
|
'default': {
|
||||||
'NAME': '/var/lib/www/database/conservancy-website.sqlite3',
|
'NAME': '/var/lib/www/database/conservancy-website.sqlite3',
|
||||||
'ENGINE': 'django.db.backends.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,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue