Skip to content

Commit 81fac05

Browse files
Remove moved private methods and constants from Session
1 parent 33a978a commit 81fac05

1 file changed

Lines changed: 0 additions & 35 deletions

File tree

lib/mongo/session.rb

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff 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
13081273
end

0 commit comments

Comments
 (0)