From a94dcf94e9772347e259cddec93f777160e9eca9 Mon Sep 17 00:00:00 2001 From: Miroslav Stampar Date: Wed, 22 Apr 2015 16:41:20 +0200 Subject: [PATCH] =?UTF-8?q?Patch=20for=20an=20Issue=20#1226=C4=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/utils/api.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/lib/utils/api.py b/lib/utils/api.py index 15a1047b6..987391c55 100644 --- a/lib/utils/api.py +++ b/lib/utils/api.py @@ -77,10 +77,17 @@ class Database(object): self.connection.commit() def execute(self, statement, arguments=None): - if arguments: - self.cursor.execute(statement, arguments) - else: - self.cursor.execute(statement) + while True: + try: + if arguments: + self.cursor.execute(statement, arguments) + else: + self.cursor.execute(statement) + except sqlite3.OperationalError, ex: + if not "locked" in ex.message: + raise + else: + break if statement.lstrip().upper().startswith("SELECT"): return self.cursor.fetchall()