-
Notifications
You must be signed in to change notification settings - Fork 175
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
handle more connection parameters #20
Conversation
@@ -142,10 +149,13 @@ def key(suffix): | |||
app.config[key('DBNAME')] = parsed['database'] | |||
app.config[key('READ_PREFERENCE')] = parsed['options'].get('read_preference') | |||
app.config[key('AUTO_START_REQUEST')] = parsed['options'].get('auto_start_request', True) | |||
app.config[key('USE_GREENLETS')] = parsed['options'].get('use_greenlets', False) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As discussed in #15, we (the PyMongo maintainers and I) prefer not to expose internal details like use_greenlets
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Heh, in PyMongo 2.4.2 we are starting to expose this. Not because it's useful to application developers though. It solves a problem with MasterSlaveConnection. In PyMongo 3.0 (whenever that happens) MasterSlaveConnection will go away, as well as this property.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe a Flask app would never want to set use_greenlets True, since it's either running multithreaded (in which case setting use_greenlets would cause bugs) or under Gevent (which would call patch_thread and make use_greenlets unnecessary).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right indeed, this was something I noted back then when using gevent with threads. This can be ignored, thanks for the clarification guys.
@ultrabug after consultation with the experts, I think the right path is to:
I'd be willing to accept a pull request or two which addressed those issues. I'd also like to hear what your use case for using the timeouts is. |
I commented on the related diffs, as for the validation I also agree with you guys to rely on pymongo's direcly (I added those just to be compliant with what seemed to be your current policy on flask-pymongo). @dcrosta : based on your final observations about the timeouts, I'll be glad to propose a new pull request to address all those matters at once. Thank you for your help. |
Hi Dan,
Would you please consider those commits ? They add connection parameters support for :
[1] http://api.mongodb.org/python/current/api/pymongo/index.html#pymongo.read_preferences.ReadPreference
Thank you :)