From c715654bd909aef29d36ded867b2453f4443a6d5 Mon Sep 17 00:00:00 2001 From: Ryan Sanford Date: Tue, 12 Jan 2016 13:30:59 -0600 Subject: [PATCH 1/3] Resolve "No replica set members found yet" errors when using mongodb connections when API is hosted by API. --- api/config.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/api/config.py b/api/config.py index 601e520d3..a3c04084b 100644 --- a/api/config.py +++ b/api/config.py @@ -77,7 +77,8 @@ __config['persistent']['db_uri'], j=True, connectTimeoutMS=__config['persistent']['db_connect_timeout'], - serverSelectionTimeoutMS=__config['persistent']['db_server_selection_timeout'] + serverSelectionTimeoutMS=__config['persistent']['db_server_selection_timeout'], + connect=False ).get_default_database() log.debug(str(db)) From 4afccf30ebc38a6b1557c605fc8a4b4d1662b85c Mon Sep 17 00:00:00 2001 From: Ryan Sanford Date: Wed, 13 Jan 2016 06:38:53 -0600 Subject: [PATCH 2/3] Reduce future diff sizes by adding trailing ',' --- api/config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/config.py b/api/config.py index a3c04084b..83466642d 100644 --- a/api/config.py +++ b/api/config.py @@ -78,7 +78,7 @@ j=True, connectTimeoutMS=__config['persistent']['db_connect_timeout'], serverSelectionTimeoutMS=__config['persistent']['db_server_selection_timeout'], - connect=False + connect=False, ).get_default_database() log.debug(str(db)) From 276eda908e9673c9c6c89010f27fa80f4838f142 Mon Sep 17 00:00:00 2001 From: Ryan Sanford Date: Wed, 13 Jan 2016 07:01:05 -0600 Subject: [PATCH 3/3] Add comments to clarify intent Clarify the intent of both 'j' and 'connect' options of pymongo.MongoClient(). closes #123 --- api/config.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/api/config.py b/api/config.py index 83466642d..e9cc9295f 100644 --- a/api/config.py +++ b/api/config.py @@ -75,10 +75,10 @@ db = pymongo.MongoClient( __config['persistent']['db_uri'], - j=True, + j=True, # Requests only return once write has hit the DB journal connectTimeoutMS=__config['persistent']['db_connect_timeout'], serverSelectionTimeoutMS=__config['persistent']['db_server_selection_timeout'], - connect=False, + connect=False, # Connect on first operation to avoid multi-threading related errors ).get_default_database() log.debug(str(db))