Auto-refresh will be disabled by default.
This commit is contained in:
parent
1da5778c38
commit
9b6589e033
@ -41,7 +41,11 @@ the state of any secondary node, the automated refresh will ensure that this sta
|
||||
If you add a secondary that responds to pings much faster than the existing nodes, then the new secondary will
|
||||
be used for reads.
|
||||
|
||||
Refresh mode is enabled in synchronous mode by default. This is the recommended setting, but here's how to specify this explicitly:
|
||||
Refresh mode is disabled by default.
|
||||
|
||||
However, if you expect to make live changes to your secondaries, and you want this to be reflected without
|
||||
having to manually restart your app server, then you should enable it. You can enable synchronously, which will
|
||||
refresh the replica set data in a synchronous fashion (which may ocassionally slow down your queries):
|
||||
|
||||
@connection = ReplSetConnection.new(['n1.mydb.net', 27017], :refresh_mode => :sync)
|
||||
|
||||
|
@ -57,7 +57,7 @@ module Mongo
|
||||
# @option opts [Float] :connect_timeout (nil) The number of seconds to wait before timing out a
|
||||
# connection attempt.
|
||||
# @option opts [Boolean] :ssl (false) If true, create the connection to the server using SSL.
|
||||
# @option opts [Boolean] :refresh_mode (:sync) Set this to :async to enable a background thread that
|
||||
# @option opts [Boolean] :refresh_mode (false) Set this to :async to enable a background thread that
|
||||
# periodically updates the state of the connection. If, for example, you initially connect while a secondary
|
||||
# is down, this will reconnect to that secondary behind the scenes to
|
||||
# prevent you from having to reconnect manually. If set to :sync, refresh will happen
|
||||
@ -117,7 +117,7 @@ module Mongo
|
||||
@arbiters = []
|
||||
|
||||
# Refresh
|
||||
@refresh_mode = opts.fetch(:refresh_mode, :sync)
|
||||
@refresh_mode = opts.fetch(:refresh_mode, false)
|
||||
@refresh_interval = opts[:refresh_interval] || 90
|
||||
@last_refresh = Time.now
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user