Skip to content

Commit 6ec893a

Browse files
Apply suggestions from code review
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent a963526 commit 6ec893a

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

lib/mongo/session.rb

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,7 @@ def with_transaction(options = nil)
451451
# CSOT enabled, so we have a custom-defined deadline.
452452
@with_transaction_deadline
453453
else
454-
# CSOT not enabled, so we use the default deadline, 120 seconds.
454+
# CSOT not enabled, so we use the default deadline, 120 seconds.
455455
Utils.monotonic_time + 120
456456
end
457457
transaction_in_progress = false
@@ -494,7 +494,7 @@ def with_transaction(options = nil)
494494
return rv
495495
rescue Mongo::Error => e
496496
if e.label?('UnknownTransactionCommitResult')
497-
if deadline_expired?(deadline) ||
497+
if deadline_expired?(deadline) ||
498498
e.is_a?(Error::OperationFailure::Family) && e.max_time_ms_expired?
499499
then
500500
transaction_in_progress = false
@@ -1185,7 +1185,10 @@ def txn_num
11851185
# @api private
11861186
attr_accessor :snapshot_timestamp
11871187

1188-
# @return [ Integer | nil ] The deadline for the current transaction, if any.
1188+
# @return [ Numeric | nil ] The deadline for the current transaction, if any.
1189+
# - nil when CSOT is disabled
1190+
# - 0 (Integer) when timeout_ms is set to 0 (representing infinite timeout)
1191+
# - Float representing the deadline timestamp when CSOT is enabled with a positive timeout
11891192
# @api private
11901193
attr_reader :with_transaction_deadline
11911194

0 commit comments

Comments
 (0)