mirror of
https://github.com/TitanEmbeds/Titan.git
synced 2024-11-15 02:21:21 +01:00
Keep trying until session obtained
This commit is contained in:
parent
1e43f607b6
commit
5364cf9004
@ -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()
|
||||||
|
Loading…
Reference in New Issue
Block a user