mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
added atexit to custom db connector to run uninstall on exit
This commit is contained in:
parent
19f810ff57
commit
1ca674f33f
1 changed files with 3 additions and 1 deletions
|
|
@ -13,6 +13,7 @@ import logging
|
|||
import tempfile
|
||||
import functools
|
||||
import contextlib
|
||||
import atexit
|
||||
|
||||
import requests
|
||||
|
||||
|
|
@ -71,7 +72,7 @@ class DbConnector:
|
|||
"""Establish a persistent connection to the database"""
|
||||
if self._is_installed:
|
||||
return
|
||||
|
||||
atexit.register(self.uninstall)
|
||||
logging.basicConfig()
|
||||
|
||||
self._mongo_client = pymongo.MongoClient(
|
||||
|
|
@ -113,6 +114,7 @@ class DbConnector:
|
|||
self._mongo_client = None
|
||||
self._database = None
|
||||
self._is_installed = False
|
||||
atexit.unregister(self.uninstall)
|
||||
|
||||
def tables(self):
|
||||
"""List available tables
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue