aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Larson <chris_larson@mentor.com>2011-02-09 17:56:42 -0700
committerChris Larson <chris_larson@mentor.com>2011-02-11 20:31:09 -0700
commit01d12f4f96447aeda48e504fb0708c2e0dc91e30 (patch)
tree7a45dee7b9b6b13db9490b35a86571c83e2df996
parent34c7ff67d7f4c7dde2027e000def1a49f3286829 (diff)
downloadbitbake-01d12f4f96447aeda48e504fb0708c2e0dc91e30.tar.gz
bitbake-01d12f4f96447aeda48e504fb0708c2e0dc91e30.tar.bz2
bitbake-01d12f4f96447aeda48e504fb0708c2e0dc91e30.zip
persist_data: handle lock in sqlite and use the shared cache
Signed-off-by: Chris Larson <chris_larson@mentor.com>
-rw-r--r--lib/bb/persist_data.py14
1 files changed, 3 insertions, 11 deletions
diff --git a/lib/bb/persist_data.py b/lib/bb/persist_data.py
index b5ce371d..2c424f29 100644
--- a/lib/bb/persist_data.py
+++ b/lib/bb/persist_data.py
@@ -39,6 +39,7 @@ if sqlversion[0] < 3 or (sqlversion[0] == 3 and sqlversion[1] < 3):
logger = logging.getLogger("BitBake.PersistData")
+sqlite3.enable_shared_cache(True)
class SQLTable(collections.MutableMapping):
@@ -51,16 +52,7 @@ class SQLTable(collections.MutableMapping):
% table)
def _execute(self, *query):
- """Execute a query, waiting to acquire a lock if necessary"""
- count = 0
- while True:
- try:
- return self.cursor.execute(*query)
- except sqlite3.OperationalError as exc:
- if 'database is locked' in str(exc) and count < 500:
- count = count + 1
- continue
- raise
+ return self.cursor.execute(*query)
def __getitem__(self, key):
data = self._execute("SELECT * from %s where key=?;" %
@@ -159,7 +151,7 @@ class PersistData(object):
del self.data[domain][key]
def connect(database):
- return sqlite3.connect(database, timeout=5, isolation_level=None)
+ return sqlite3.connect(database, timeout=30, isolation_level=None)
def persist(domain, d):
"""Convenience factory for SQLTable objects based upon metadata"""