RUBY-420 enforce lower bound on refresh interval
This commit is contained in:
parent
6944794fb2
commit
0e8eef6cdd
|
@ -476,7 +476,10 @@ module Mongo
|
|||
|
||||
# Refresh
|
||||
@refresh_mode = opts.fetch(:refresh_mode, false)
|
||||
@refresh_interval = opts[:refresh_interval] || 90
|
||||
@refresh_interval = opts.fetch(:refresh_interval, 90)
|
||||
if @refresh_mode && @refresh_interval < 60
|
||||
@refresh_interval = 60
|
||||
end
|
||||
|
||||
if @refresh_mode == :async
|
||||
warn ":async refresh mode has been deprecated. Refresh
|
||||
|
|
|
@ -41,6 +41,12 @@ class ConnectionTest < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
context "given a replica set" do
|
||||
should "enforce a minimum refresh_interval" do
|
||||
@conn = ReplSetConnection.new(['localhost:27017'],
|
||||
:connect => false, :refresh_mode => :sync, :refresh_interval => 10)
|
||||
assert_equal 60, @conn.refresh_interval
|
||||
end
|
||||
|
||||
should "warn if invalid options are specified" do
|
||||
conn = ReplSetConnection.allocate
|
||||
opts = {:connect => false}
|
||||
|
|
Loading…
Reference in New Issue