Przeglądaj źródła

Try handling unclosed sql connections by calling dispose on the engine before it is put back into the pool.

ogert 5 lat temu
rodzic
commit
708d3226b2
1 zmienionych plików z 2 dodań i 1 usunięć
  1. 2 1
      cdplib/db_handlers/SQLHandler.py

+ 2 - 1
cdplib/db_handlers/SQLHandler.py

@@ -26,6 +26,7 @@ class SQLHandlerPool(metaclass=SingletonThreadsafe):
     def __init__(self, size: int = 20):
         self._size = size
         self._log = Log(name='SQLHandlerPool')
+        self._log('############################# CREATED NEW POOL ###################################')
         self._sql_handlers = [SQLHandler() for _ in range(size)]
 
     def aquire(self):
@@ -39,7 +40,7 @@ class SQLHandlerPool(metaclass=SingletonThreadsafe):
         if len(self._sql_handlers) < self._size:
             self._sql_handlers.append(sql_handler)
 
-class SQLHandler:
+class SQLHandler(metaclass=SingletonThreadsafe):
     '''
     Resembles methods for executing sql queries
     with different dabase connectors.