summaryrefslogtreecommitdiffstats
path: root/lib/toaster/toastermain
diff options
context:
space:
mode:
authorMichael Wood <michael.g.wood@intel.com>2015-08-06 19:01:36 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-08-06 16:04:10 -0500
commit7f3a4e0330f4de3ba8e092bc1c15a53d8c2be073 (patch)
tree2ba1d6be0b120ca47c2c0151cb5ebf6c640478a0 /lib/toaster/toastermain
parentb5100bfd4cb32a9b59b0554c6dbc3a4295da7d8e (diff)
downloadbitbake-7f3a4e0330f4de3ba8e092bc1c15a53d8c2be073.tar.gz
toastermain: Add a longer default database timeout
When using sqlite we sometimes see Database Locked exceptions when we fire off database calls asynchronously from the UI. We need sqlite to wait a bit longer for the lock to be released. n.b In production setup we hopefully wouldn't be using sqlite. docs.djangoproject.com/en/1.6/ref/databases/#database-is-locked-errors Signed-off-by: Michael Wood <michael.g.wood@intel.com> Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'lib/toaster/toastermain')
-rw-r--r--lib/toaster/toastermain/settings.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/toaster/toastermain/settings.py b/lib/toaster/toastermain/settings.py
index c72a90411..b149a5ed8 100644
--- a/lib/toaster/toastermain/settings.py
+++ b/lib/toaster/toastermain/settings.py
@@ -49,6 +49,12 @@ DATABASES = {
}
}
+# Needed when Using sqlite especially to add a longer timeout for waiting
+# for the database lock to be released
+# https://docs.djangoproject.com/en/1.6/ref/databases/#database-is-locked-errors
+if 'sqlite' in DATABASES['default']['ENGINE']:
+ DATABASES['default']['OPTIONS'] = { 'timeout': 20 }
+
# Reinterpret database settings if we have DATABASE_URL environment variable defined
if 'DATABASE_URL' in os.environ: