Преглед на файлове

Add destructor which closes the mongo connection

ogert преди 5 години
родител
ревизия
9fedf779ca
променени са 1 файла, в които са добавени 2 реда и са изтрити 0 реда
  1. 2 0
      cdplib/db_handlers/MongodbHandler.py

+ 2 - 0
cdplib/db_handlers/MongodbHandler.py

@@ -95,6 +95,8 @@ class MongodbHandler:
             self._log.info(('Database: {} didnt exist, it will be created for you once a collection is created in it').format(database_name))
         self._database = self._client[database_name]
 
+    def __del__(self):
+        self._client.close()
 
     def drop_database(self):
         '''