mirror of
https://github.com/TitanEmbeds/Titan.git
synced 2025-06-16 19:35:24 +02:00
Keep trying until session obtained
This commit is contained in:
@ -33,7 +33,12 @@ class DatabaseInterface(object):
|
|||||||
|
|
||||||
@contextmanager
|
@contextmanager
|
||||||
def get_session(self) -> Session:
|
def get_session(self) -> Session:
|
||||||
|
session = None
|
||||||
|
while session == None:
|
||||||
|
try:
|
||||||
session = self._sessionmaker() # type: Session
|
session = self._sessionmaker() # type: Session
|
||||||
|
except:
|
||||||
|
pass
|
||||||
try:
|
try:
|
||||||
yield session
|
yield session
|
||||||
session.commit()
|
session.commit()
|
||||||
|
Reference in New Issue
Block a user