diff --git a/discordbot/titanembeds/database/__init__.py b/discordbot/titanembeds/database/__init__.py index e2f3f6c..9f5f2e1 100644 --- a/discordbot/titanembeds/database/__init__.py +++ b/discordbot/titanembeds/database/__init__.py @@ -33,7 +33,13 @@ class DatabaseInterface(object): @contextmanager def get_session(self) -> Session: - session = self._sessionmaker() # type: Session + got_session = False + while not got_session: + try: + session = self._sessionmaker() # type: Session + got_session = True + except: + pass try: yield session session.commit()