diff --git a/db.py b/db.py index 710e375..c6a260b 100644 --- a/db.py +++ b/db.py @@ -19,8 +19,7 @@ def __init__(self, settings: Settings): def get_session(self) -> Session: return self.session() - # TODO: singleton implementation - # def __new__(cls): - # if not hasattr(cls, 'instance'): - # cls.instance = super(Database, cls).__new__(cls) - # return cls.instance + def __new__(cls, settings: Settings): + if not hasattr(cls, 'instance'): + cls.instance = super(Database, cls).__new__(cls) + return cls.instance