diff options
-rw-r--r-- | lib/bb/persist_data.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/bb/persist_data.py b/lib/bb/persist_data.py index 0ebdf36f4..b8c239294 100644 --- a/lib/bb/persist_data.py +++ b/lib/bb/persist_data.py @@ -52,12 +52,14 @@ class SQLTable(collections.MutableMapping): def _execute(self, *query): """Execute a query, waiting to acquire a lock if necessary""" + count = 0 while True: try: return self.cursor.execute(*query) break except sqlite3.OperationalError as exc: - if 'database is locked' in str(exc): + if 'database is locked' in str(exc) and count < 500: + count = count + 1 continue raise |