From 2dcc77422348e55b6f7028679647cfbdf872f6a2 Mon Sep 17 00:00:00 2001 From: Malini Kamalambal Date: Tue, 18 Feb 2014 13:45:18 -0500 Subject: [PATCH] Add retry to connect to mongo db This patch adds retries to connect to the mongodb, after a restart. Change-Id: I16e37614736c247fa0b737db2b868c052c2aa33a --- lib/marconi | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/marconi b/lib/marconi index 88312cb1bd..b6ce57a295 100644 --- a/lib/marconi +++ b/lib/marconi @@ -68,7 +68,9 @@ function is_marconi_enabled { # cleanup_marconi() - Remove residual data files, anything left over from previous # runs that a clean run would need to clean up function cleanup_marconi() { - mongo marconi --eval "db.dropDatabase();" + if ! timeout $SERVICE_TIMEOUT sh -c "while ! mongo marconi --eval 'db.dropDatabase();'; do sleep 1; done"; then + die $LINENO "Mongo DB did not start" + fi } # configure_marconiclient() - Set config files, create data dirs, etc