From b12e51c352e8a8bc7dbe76205dca7f7100bd218e Mon Sep 17 00:00:00 2001 From: Michael Wood Date: Thu, 6 Aug 2015 19:01:36 +0300 Subject: bitbake: 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 (Bitbake rev: 7f3a4e0330f4de3ba8e092bc1c15a53d8c2be073) Signed-off-by: Michael Wood Signed-off-by: Ed Bartosh Signed-off-by: Richard Purdie --- bitbake/lib/toaster/toastermain/settings.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/bitbake/lib/toaster/toastermain/settings.py b/bitbake/lib/toaster/toastermain/settings.py index c72a90411b..b149a5ed83 100644 --- a/bitbake/lib/toaster/toastermain/settings.py +++ b/bitbake/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: -- cgit v1.2.3-54-g00ecf