Retry select after half a second
This commit is contained in:
parent
da02aca7e4
commit
ccf41bec79
@ -1,3 +1,5 @@
|
|||||||
|
import time
|
||||||
|
|
||||||
from cpl_core.database import DatabaseSettings
|
from cpl_core.database import DatabaseSettings
|
||||||
from cpl_core.database.context import DatabaseContext
|
from cpl_core.database.context import DatabaseContext
|
||||||
|
|
||||||
@ -31,4 +33,9 @@ class DBContext(DatabaseContext):
|
|||||||
return super(DBContext, self).select(statement)
|
return super(DBContext, self).select(statement)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self._logger.error(__name__, f"Database error caused by {statement}", e)
|
self._logger.error(__name__, f"Database error caused by {statement}", e)
|
||||||
|
try:
|
||||||
|
time.sleep(0.5)
|
||||||
|
return self.select(statement)
|
||||||
|
except Exception as e:
|
||||||
|
pass
|
||||||
return []
|
return []
|
||||||
|
Loading…
Reference in New Issue
Block a user