File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1269,40 +1269,5 @@ def calculate_with_transaction_deadline(opts)
12691269 end
12701270 end
12711271
1272- def deadline_expired? ( deadline )
1273- if deadline . zero?
1274- false
1275- else
1276- Utils . monotonic_time >= deadline
1277- end
1278- end
1279-
1280- # Exponential backoff settings for with_transaction retries.
1281- BACKOFF_INITIAL = 0.005
1282- BACKOFF_MAX = 0.5
1283- private_constant :BACKOFF_INITIAL , :BACKOFF_MAX
1284-
1285- def backoff_seconds_for_retry ( transaction_attempt )
1286- exponential = BACKOFF_INITIAL * ( 1.5 ** ( transaction_attempt - 1 ) )
1287- Random . rand * [ exponential , BACKOFF_MAX ] . min
1288- end
1289-
1290- def backoff_would_exceed_deadline? ( deadline , backoff_seconds )
1291- return false if deadline . zero?
1292-
1293- Utils . monotonic_time + backoff_seconds >= deadline
1294- end
1295-
1296- # Implements makeTimeoutError(lastError) from the transactions-convenient-api spec.
1297- # In CSOT mode raises TimeoutError with last_error's message included as a substring.
1298- # In non-CSOT mode re-raises last_error directly.
1299- def make_timeout_error_from ( last_error , timeout_message )
1300- if @with_transaction_timeout_ms
1301- raise Mongo ::Error ::TimeoutError , "#{ timeout_message } : #{ last_error } "
1302- else
1303- raise last_error
1304- end
1305- end
1306-
13071272 end
13081273end
You can’t perform that action at this time.
0 commit comments