From 04b9538debdad07cb9351fda3d0ca1e9be6f4dbe Mon Sep 17 00:00:00 2001 From: Veiko Aasa Date: Tue, 3 Mar 2020 10:02:59 +0200 Subject: [PATCH] plinth: Increase sqlite busy timeout from default 5s to 30s Reduces the probability that plinth gives an error 500 because the database is locked. Test performed: 1) Lock the database: > sqlite3 data/var/lib/plinth/plinth.sqlite3 sqlite> PRAGMA locking_mode = EXCLUSIVE; sqlite> BEGIN EXCLUSIVE; 2) Visit plinth/apps/ 3) Only after 30s plinth logs an exception: django.db.utils.OperationalError: database is locked Closes #1786 Related to #1443 Signed-off-by: Veiko Aasa [sunil: Move the timeout value to settings module as it is static] Signed-off-by: Sunil Mohan Adapa Reviewed-by: Sunil Mohan Adapa --- plinth/settings.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plinth/settings.py b/plinth/settings.py index effb75744..dbdd97f35 100644 --- a/plinth/settings.py +++ b/plinth/settings.py @@ -67,6 +67,9 @@ CAPTCHA_FLITE_PATH = '/usr/bin/flite' DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', + 'OPTIONS': { + 'timeout': 30 + }, # Overridden based on the configuration key store_file 'NAME': '/var/lib/plinth/plinth.sqlite3' }