Skip to contentSkip to conversation

bitbake: toastermain: Add a longer default database timeout

PATCH New Michael Wood 1 participant 1 message Jul 30, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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/lib/toaster/toastermain/settings.py | 7 +++++++
 1 file changed, 7 insertions(+)
bitbake/lib/toaster/toastermain/settings.py +7 -0
index c72a904..ca32665 100644
@@ -46,6 +46,13 @@ DATABASES = {
         'PASSWORD': '',
         'HOST': '127.0.0.1',                      # Empty for localhost through domain sockets or '127.0.0.1' for localhost through TCP.
         'PORT': '3306',                      # Set to empty string for default.
+
+        # 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
+        'OPTIONS': {
+            'timeout': 20,
+        },
     }
 }
 
Signature · 1 line
2.1.4