Created
November 30, 2015 14:01
-
-
Save bartosh/eacae69f8f701964fe46 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- a/bitbake/lib/bb/ui/buildinfohelper.py | |
+++ b/bitbake/lib/bb/ui/buildinfohelper.py | |
@@ -20,13 +20,14 @@ import sys | |
import bb | |
import re | |
import os | |
+import time | |
os.environ["DJANGO_SETTINGS_MODULE"] = "toaster.toastermain.settings" | |
import django | |
from django.utils import timezone | |
- | |
+from django.db import OperationalError | |
def _configure_toaster(): | |
""" Add toaster to sys path for importing modules | |
@@ -98,8 +99,15 @@ class ORMWrapper(object): | |
created = False | |
if not key in vars(self)[dictname].keys(): | |
- vars(self)[dictname][key], created = \ | |
- clazz.objects.get_or_create(**kwargs) | |
+ while True: | |
+ try: | |
+ vars(self)[dictname][key], created = \ | |
+ clazz.objects.get_or_create(**kwargs) | |
+ except OperationalError as err: | |
+ print '>>>>', err | |
+ time.sleep(2) | |
+ else: | |
+ break | |
return (vars(self)[dictname][key], created) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment