bitbake: prserv: Ensure data is committed

In exclusive mode, we need to complete the transaction for writes to make
it to the database. Therefore add sync calls to ensure this happens.

Autocommit mode is significantly (100 times) slower so caching the
data is of significant benefit.

(Bitbake rev: 4e55f7821786a59c2cd7dbd8bfa2a22f5f196e99)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Richard Purdie 2013-09-08 09:45:54 +00:00
parent 31709ed0af
commit 2ab1bf27f7
2 changed files with 6 additions and 1 deletions

View File

@ -43,6 +43,10 @@ class PRTable(object):
continue
raise exc
def sync(self):
self.conn.commit()
self._execute("BEGIN EXCLUSIVE TRANSACTION")
def _getValueHist(self, version, pkgarch, checksum):
data=self._execute("SELECT value FROM %s WHERE version=? AND pkgarch=? AND checksum=?;" % self.table,
(version, pkgarch, checksum))

View File

@ -74,7 +74,7 @@ class PRServer(SimpleXMLRPCServer):
except:
self.handle_error(request, client_address)
self.shutdown_request(request)
self.table.sync()
def process_request(self, request, client_address):
self.requestqueue.put((request, client_address))
@ -120,6 +120,7 @@ class PRServer(SimpleXMLRPCServer):
while not self.quit:
self.handle_request()
self.table.sync()
logger.info("PRServer: stopping...")
self.server_close()
return