Skip to content

Commit a66ea77

Browse files
authored
Merge pull request #877 from rinmu/master
RUBY-1223 Ignore lastWrite when comparing server descriptions
2 parents 844fd44 + 26c5873 commit a66ea77

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

lib/mongo/server/description.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ class Description
157157
# Fields to exclude when comparing two descriptions.
158158
#
159159
# @since 2.0.6
160-
EXCLUDE_FOR_COMPARISON = [ LOCAL_TIME ].freeze
160+
EXCLUDE_FOR_COMPARISON = [ LOCAL_TIME, LAST_WRITE ].freeze
161161

162162
# @return [ Address ] address The server's address.
163163
attr_reader :address

spec/mongo/server/description_spec.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
'maxWireVersion' => 2,
2424
'minWireVersion' => 0,
2525
'localTime' => Time.now,
26+
'lastWrite' => { 'lastWriteDate' => Time.now },
2627
'ok' => 1
2728
}
2829
end
@@ -838,7 +839,10 @@
838839
end
839840

840841
let(:other) do
841-
described_class.new(address, replica.merge('localTime' => 1))
842+
described_class.new(address, replica.merge(
843+
'localTime' => 1,
844+
'lastWrite' => { 'lastWriteDate' => 1 }
845+
))
842846
end
843847

844848
it 'excludes certain fields' do

0 commit comments

Comments
 (0)