[llvm-commits] [LNT] r163347 - /lnt/trunk/lnt/server/db/v4db.py

Michael Gottesman mgottesman at apple.com
Thu Sep 6 13:26:41 PDT 2012


Author: mgottesman
Date: Thu Sep  6 15:26:41 2012
New Revision: 163347

URL: http://llvm.org/viewvc/llvm-project?rev=163347&view=rev
Log:
v4db.py: Removed singleton engine for a dictionary mapping paths to
engines.

This fixes a bug where only the first v4db created will ever have its
engine be used.

Modified:
    lnt/trunk/lnt/server/db/v4db.py

Modified: lnt/trunk/lnt/server/db/v4db.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/db/v4db.py?rev=163347&r1=163346&r2=163347&view=diff
==============================================================================
--- lnt/trunk/lnt/server/db/v4db.py (original)
+++ lnt/trunk/lnt/server/db/v4db.py Thu Sep  6 15:26:41 2012
@@ -21,7 +21,7 @@
 
     _db_updated = set()
     _engine_lock = threading.Lock()
-    _engine = None
+    _engine = {}
 
     class TestSuiteAccessor(object):
         def __init__(self, v4db):
@@ -74,9 +74,9 @@
 
         self.path = path
         with V4DB._engine_lock:
-            if V4DB._engine is None:
-                V4DB._engine = sqlalchemy.create_engine(path, echo=echo)
-        self.engine = V4DB._engine
+            if path not in V4DB._engine:
+                V4DB._engine[path] = sqlalchemy.create_engine(path, echo=echo)
+        self.engine = V4DB._engine[path]
 
         # Update the database to the current version, if necessary. Only check
         # this once per path.





More information about the llvm-commits mailing list