@@ -111,11 +111,9 @@ def nro_write_with_retry(_write_concern, context:, &block)
111111 error_count = 0
112112 error_to_raise = nil
113113 begin
114- result = server . with_connection ( connection_global_id : context . connection_global_id ) do |connection |
114+ server . with_connection ( connection_global_id : context . connection_global_id ) do |connection |
115115 yield connection , nil , context
116116 end
117- retry_policy . record_success ( is_retry : error_count > 0 ) if error_count > 0
118- result
119117 rescue Error ::TimeoutError
120118 raise
121119 rescue *retryable_exceptions , Error ::PoolError , Error ::OperationFailure ::Family => e
@@ -254,7 +252,7 @@ def modern_write_with_retry(session, server, context, &block)
254252 connection_succeeded = false
255253 was_starting = false
256254
257- result = server . with_connection (
255+ server . with_connection (
258256 connection_global_id : context . connection_global_id ,
259257 context : context
260258 ) do |connection |
@@ -268,8 +266,6 @@ def modern_write_with_retry(session, server, context, &block)
268266 # it later for the retry as well.
269267 yield connection , txn_num , context . dup
270268 end
271- retry_policy . record_success ( is_retry : false )
272- result
273269 rescue *retryable_exceptions , Error ::PoolError , Auth ::Unauthorized , Error ::OperationFailure ::Family => e
274270 e . add_notes ( 'modern retry' , 'attempt 1' )
275271
@@ -344,11 +340,9 @@ def retry_write(original_error, txn_num, context:, failed_server: nil, &block)
344340
345341 attempt = attempt ? attempt + 1 : 2
346342 log_retry ( original_error , message : 'Write retry' )
347- result = server . with_connection ( connection_global_id : context . connection_global_id ) do |connection |
343+ server . with_connection ( connection_global_id : context . connection_global_id ) do |connection |
348344 yield ( connection , txn_num , context )
349345 end
350- retry_policy . record_success ( is_retry : true )
351- result
352346 rescue *retryable_exceptions , Error ::PoolError => e
353347 if retryable_overload_error? ( e )
354348 e . add_notes ( 'modern retry' , "attempt #{ attempt } " )
@@ -414,7 +408,6 @@ def overload_write_retry(last_error, session, txn_num, context:, failed_server:,
414408 result = server . with_connection ( connection_global_id : context . connection_global_id ) do |connection |
415409 yield connection , txn_num , context
416410 end
417- retry_policy . record_success ( is_retry : true )
418411 return result
419412 rescue Error ::TimeoutError
420413 raise
@@ -430,7 +423,6 @@ def overload_write_retry(last_error, session, txn_num, context:, failed_server:,
430423 unless e . respond_to? ( :label? ) && e . label? ( 'NoWritesPerformed' )
431424 error_to_raise = e
432425 end
433- retry_policy . record_non_overload_retry_failure unless is_overload
434426 context = context . with ( overload_only_retry : false ) unless is_overload
435427 failed_server = server
436428 last_error = e
0 commit comments