summaryrefslogtreecommitdiffstats
path: root/bitbake/lib
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/lib')
-rw-r--r--bitbake/lib/prserv/db.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/bitbake/lib/prserv/db.py b/bitbake/lib/prserv/db.py
index 7bc1980099..b7190bad01 100644
--- a/bitbake/lib/prserv/db.py
+++ b/bitbake/lib/prserv/db.py
@@ -2,6 +2,7 @@ import logging
2import os.path 2import os.path
3import errno 3import errno
4import prserv 4import prserv
5import time
5 6
6try: 7try:
7 import sqlite3 8 import sqlite3
@@ -32,13 +33,13 @@ class PRTable(object):
32 33
33 def _execute(self, *query): 34 def _execute(self, *query):
34 """Execute a query, waiting to acquire a lock if necessary""" 35 """Execute a query, waiting to acquire a lock if necessary"""
35 count = 0 36 start = time.time()
37 end = start + 20
36 while True: 38 while True:
37 try: 39 try:
38 return self.conn.execute(*query) 40 return self.conn.execute(*query)
39 except sqlite3.OperationalError as exc: 41 except sqlite3.OperationalError as exc:
40 if 'is locked' in str(exc) and count < 500: 42 if 'is locked' in str(exc) and end > time.time():
41 count = count + 1
42 continue 43 continue
43 raise exc 44 raise exc
44 45