Skip to content

Commit

Permalink
3368
Browse files Browse the repository at this point in the history
  • Loading branch information
comandeo-mongo committed Feb 13, 2024
1 parent ba93e1e commit f7f3e88
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/mongo/server/connection_pool.rb
Original file line number Diff line number Diff line change
Expand Up @@ -984,7 +984,7 @@ def maybe_raise_pool_cleared!(connection, e)

# Attempts to connect (handshake and auth) the connection. If an error is
# encountered, closes the connection and raises the error.
def connect_connection(connection, context)
def connect_connection(connection, context = nil)
begin
connection.connect!(context)
rescue Exception
Expand Down
10 changes: 6 additions & 4 deletions spec/mongo/operation/context_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

context 'when timeout_ms is positive' do
before do
expect(Mongo::Utils).to receive(:monotonic_time).and_return(100.0)
allow(Mongo::Utils).to receive(:monotonic_time).and_return(100.0)
end

let(:timeout_ms) { 10_000 }
Expand All @@ -46,7 +46,9 @@
end

describe '#remaining_timeout_ms' do
let(:context) { described_class.new(timeout_ms: timeout_ms) }
let(:context) {
described_class.new(timeout_ms: timeout_ms)
}

context 'when timeout_ms is nil' do
let(:timeout_ms) { nil }
Expand All @@ -66,8 +68,8 @@

context 'when timeout_ms is positive' do
before do
expect(Mongo::Utils).to receive(:monotonic_time).ordered.and_return(100.0)
expect(Mongo::Utils).to receive(:monotonic_time).ordered.and_return(105.0)
allow(Mongo::Utils).to receive(:monotonic_time).ordered.and_return([100.0, 105.0])
# allow(Mongo::Utils).to receive(:monotonic_time).ordered.and_return(105.0)
end

let(:timeout_ms) { 10_000 }
Expand Down

0 comments on commit f7f3e88

Please sign in to comment.