]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
prserv/serv: Close the DB connection out of class destructor
authorLeonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com>
Wed, 23 Sep 2015 13:39:27 +0000 (13:39 +0000)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Sat, 26 Sep 2015 17:03:29 +0000 (18:03 +0100)
When launching the PR server daemon, the PRData __del__ function was being
called (no reason found yet) where the DB connection closed, thus following
PR updates were not getting into the DB. This patch closes the connection
explicitly, not relaying on the __del__ function execution.
Closing the connection in turn causes all WAL file transactions to be moved
into the database (checkpoint), thus effectively updating the database.

[YOCTO #8215]

Signed-off-by: Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
lib/prserv/db.py
lib/prserv/serv.py

index 437958013d8dea6aff92087ee0f332d5cf827d5d..36c9f7b63084d526c7c423af2ec3c69f7c4eaa11 100644 (file)
@@ -248,7 +248,7 @@ class PRData(object):
         self.connection.execute("PRAGMA journal_mode = WAL;")
         self._tables={}
 
-    def __del__(self):
+    def disconnect(self):
         self.connection.close()
 
     def __getitem__(self,tblname):
index 3cb2e03dadb32400243dad71ce33efe88e170c94..c557837b8398572ed6643caaa08c5c288d3fd82a 100644 (file)
@@ -148,7 +148,7 @@ class PRServer(SimpleXMLRPCServer):
         while not self.quit:
             self.handle_request()
         self.handlerthread.join()
-        self.table.sync()
+        self.db.disconnect()
         logger.info("PRServer: stopping...")
         self.server_close()
         return