Skip to content

Commit

Permalink
데이터베이스에 싱글턴 패턴 적용
Browse files Browse the repository at this point in the history
  • Loading branch information
riroan committed Aug 24, 2024
1 parent 1bcfca7 commit e5eae78
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions db.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit e5eae78

Please sign in to comment.