-
Notifications
You must be signed in to change notification settings - Fork 64
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
Passing :read_preference globally #206
Comments
Sounds good. It seems that this is missing! The read-preferences are already in the topology process. I will take a look at the code. |
Awesome, thanks! We initially had the For example |
You can try the PR #207 to see if this is working. |
If passing them from query params it seems to work parse and passes the read preference properly, but when given read_preference: %{
mode: :secondary,
max_staleness_ms: 120_000,
tag_sets: [dc: "west", usage: "production"]
}
|
Let me fix this issue. |
I pushed a new PR that fixes the issue. |
Thanks a lot! Tested and so far passing read_preference works both ways either passing URL or as Keyword. I don't know if this is intended or not, but when you set these read preferences, but you try to connect to single mongo instance not a cluster it timeouts in
|
Yeah, this is correct, because of the tag_sets used there. With a singleton, it does not make sense. The topology process is not able to select a server and therefore the GenServer call will timeout. |
It is fixed so far, closing the issue. |
Hi! I'm trying to set read_preference globally, right now as far as I see you have to pass them to each query explicitly.
Looking through code, would it make sense if
:read_preference
was passed toMongo.start_link/1
then right now it would already be stored inMongo.Topology
state in which case it could be used when:checkout_session
happens?Or allow passing this via URL params would also be an option.
The text was updated successfully, but these errors were encountered: