Splitting not master error and server selection timeout in mongo monitor.

This commit is contained in:
Samuel Clay 2021-10-19 11:15:47 -04:00
parent 1fdebf5c76
commit 2a8f8678dc

View file

@ -87,12 +87,14 @@ def db_check_mongo():
try:
stories = db.stories.estimated_document_count()
except (pymongo.errors.NotMasterError, pymongo.errors.ServerSelectionTimeoutError):
except pymongo.errors.NotMasterError:
abort(504)
except pymongo.errors.ServerSelectionTimeoutError:
abort(505)
except pymongo.errors.OperationFailure as e:
if 'Authentication failed' in str(e):
abort(505)
abort(506)
abort(506)
abort(507)
if not stories:
abort(510)