]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
bitbake: prserv/db: Threading fixes
authorRichard Purdie <richard.purdie@linuxfoundation.org>
Wed, 28 Aug 2013 16:06:10 +0000 (16:06 +0000)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Wed, 28 Aug 2013 23:13:22 +0000 (00:13 +0100)
Enabling threading for the PRServer causes a number of issues. Firstly is
the obtuse error:

sqlite3.InterfaceError: Error binding parameter 0 - probably unsupported type

which is due to the class not being derived from object. See:
http://docs.python.org/2/library/sqlite3.html#registering-an-adapter-callable

Secondly, we want to enable multithreadded access to the database so we do this
when we open it. This opens the way up to multithreading the PR server.

(Bitbake rev: 5709efc2ff1e36529bd28f49cd093ccfa7abff7f)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
bitbake/lib/prserv/db.py
bitbake/lib/prserv/serv.py

index 9d8e9db9f26ef86691459a3affb1a4a382d5e1bb..7d74327c5563f3659c4cf85d29e888730ff6c526 100644 (file)
@@ -14,7 +14,7 @@ sqlversion = sqlite3.sqlite_version_info
 if sqlversion[0] < 3 or (sqlversion[0] == 3 and sqlversion[1] < 3):
     raise Exception("sqlite3 version 3.3.0 or later is required.")
 
-class PRTable():
+class PRTable(object):
     def __init__(self, conn, table, nohist):
         self.conn = conn
         self.nohist = nohist
@@ -223,7 +223,7 @@ class PRData(object):
         except OSError as e:
             if e.errno != errno.EEXIST:
                 raise e
-        self.connection=sqlite3.connect(self.filename, isolation_level="DEFERRED")
+        self.connection=sqlite3.connect(self.filename, isolation_level="DEFERRED", check_same_thread = False)
         self.connection.row_factory=sqlite3.Row
         self._tables={}
 
index 6d0c7188eeca7559fdf2d05d6081d0d64bf87085..d6f3f44b047399a0798bc3af2248bf0976d517fe 100644 (file)
@@ -165,7 +165,7 @@ class PRServer(SimpleXMLRPCServer):
         self.delpid()
         os._exit(0)
 
-class PRServSingleton():
+class PRServSingleton(object):
     def __init__(self, dbfile, logfile, interface):
         self.dbfile = dbfile
         self.logfile = logfile
@@ -182,7 +182,7 @@ class PRServSingleton():
     def getinfo(self):
         return (self.host, self.port)
 
-class PRServerConnection():
+class PRServerConnection(object):
     def __init__(self, host, port):
         if is_local_special(host, port):
             host, port = singleton.getinfo()