File tree Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -471,7 +471,8 @@ def primary_wire_version_feature?(feature)
471471 end
472472
473473 def max_write_batch_size
474- local_manager && local_manager . primary_pool && local_manager . primary_pool . node . max_write_batch_size
474+ local_manager && local_manager . primary_pool && local_manager . primary_pool . node . max_write_batch_size ||
475+ DEFAULT_MAX_WRITE_BATCH_SIZE
475476 end
476477
477478 private
Original file line number Diff line number Diff line change @@ -141,5 +141,11 @@ def test_max_write_batch_size
141141 @client . local_manager . primary_pool . node . stubs ( :max_write_batch_size ) . returns ( 999 )
142142 assert_equal 999 , @client . max_write_batch_size
143143 end
144+
145+ def test_max_write_batch_size_no_manager
146+ # Simulate no local manager being set yet - RUBY-759
147+ @client . stubs ( :local_manager ) . returns ( nil )
148+ assert_equal Mongo ::MongoClient ::DEFAULT_MAX_WRITE_BATCH_SIZE , @client . max_write_batch_size
149+ end
144150end
145151
You can’t perform that action at this time.
0 commit comments