Skip to content

Commit

Permalink
Add retry to connect to mongo db
Browse files Browse the repository at this point in the history
This patch adds retries to connect to the mongodb, after a restart.

Change-Id: I16e37614736c247fa0b737db2b868c052c2aa33a
  • Loading branch information
Malini Kamalambal committed Feb 18, 2014
1 parent 535e008 commit 2dcc774
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/marconi
Expand Up @@ -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
Expand Down

0 comments on commit 2dcc774

Please sign in to comment.