Add while loop to prevent crash when DB not ready
This commit is contained in:
parent
556c09f8f6
commit
08805c9f86
10
src/main.py
10
src/main.py
@ -14,7 +14,7 @@
|
|||||||
# program. If not, see
|
# program. If not, see
|
||||||
# https://git.fjla.uk/OwlBoard/db-manager/src/branch/main/LICENSE
|
# https://git.fjla.uk/OwlBoard/db-manager/src/branch/main/LICENSE
|
||||||
|
|
||||||
version = "2.1.1"
|
version = "2.1.2"
|
||||||
print(f"main.py: Initialising db-manager v{version}")
|
print(f"main.py: Initialising db-manager v{version}")
|
||||||
|
|
||||||
#Third Party Imports
|
#Third Party Imports
|
||||||
@ -28,8 +28,14 @@ import logger as log
|
|||||||
log.out("main.py: db-manager Initialised", "INFO")
|
log.out("main.py: db-manager Initialised", "INFO")
|
||||||
|
|
||||||
|
|
||||||
#Ensure count document exists in meta:
|
#Ensure count document exists in meta, wrap in while look to prevent crashing if the DB is not ready:
|
||||||
|
dbReady = False
|
||||||
|
while dbReady is False:
|
||||||
|
try:
|
||||||
mongo.metaCounters()
|
mongo.metaCounters()
|
||||||
|
dbReady = True
|
||||||
|
except:
|
||||||
|
dbReady = False
|
||||||
|
|
||||||
#Check & Update corpus/stations:
|
#Check & Update corpus/stations:
|
||||||
# If older than 12 days then update
|
# If older than 12 days then update
|
||||||
|
Reference in New Issue
Block a user