mirror of
				https://github.com/TitanEmbeds/Titan.git
				synced 2025-11-03 23:37:09 +01:00 
			
		
		
		
	Wait until got session
This commit is contained in:
		@@ -33,7 +33,13 @@ class DatabaseInterface(object):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    @contextmanager
 | 
					    @contextmanager
 | 
				
			||||||
    def get_session(self) -> Session:
 | 
					    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:
 | 
					        try:
 | 
				
			||||||
            yield session
 | 
					            yield session
 | 
				
			||||||
            session.commit()
 | 
					            session.commit()
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user