🔧 chore(base.py): add teardown method to Engine class for proper cleanup of the database engine
🔧 chore(base.py): add logging statement to teardown method for debugging purposes 🔧 chore(base.py): call dispose method on database engine instance in teardown method to properly release resources 🔧 chore(base.py): set database engine instance to None in teardown method to ensure proper cleanup
This commit is contained in:
parent
3efecc8b9b
commit
afca3fe3e7
1 changed files with 7 additions and 0 deletions
|
|
@ -39,6 +39,13 @@ class Engine:
|
|||
cls._instance = None
|
||||
cls.create()
|
||||
|
||||
@classmethod
|
||||
def teardown(cls):
|
||||
logger.debug("Tearing down database engine")
|
||||
if cls._instance is not None:
|
||||
cls._instance.dispose()
|
||||
cls._instance = None
|
||||
|
||||
|
||||
def create_db_and_tables():
|
||||
logger.debug("Creating database and tables")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue