Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename TransactionTimeout to more descriptive LockWaitTimeout #31223

Merged
merged 1 commit into from
Nov 27, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion activerecord/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@

*Jeremy Green*

* Add new error class `TransactionTimeout` which will be raised
* Add new error class `LockWaitTimeout` which will be raised
when lock wait timeout exceeded.

*Gabriel Courtemanche*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -660,7 +660,7 @@ def translate_exception(exception, message)
when ER_LOCK_DEADLOCK
Deadlocked.new(message)
when ER_LOCK_WAIT_TIMEOUT
TransactionTimeout.new(message)
LockWaitTimeout.new(message)
when ER_QUERY_TIMEOUT
StatementTimeout.new(message)
else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ def translate_exception(exception, message)
when DEADLOCK_DETECTED
Deadlocked.new(message)
when LOCK_NOT_AVAILABLE
TransactionTimeout.new(message)
LockWaitTimeout.new(message)
when QUERY_CANCELED
StatementTimeout.new(message)
else
Expand Down
4 changes: 2 additions & 2 deletions activerecord/lib/active_record/errors.rb
Original file line number Diff line number Diff line change
Expand Up @@ -335,8 +335,8 @@ class Deadlocked < TransactionRollbackError
class IrreversibleOrderError < ActiveRecordError
end

# TransactionTimeout will be raised when lock wait timeout exceeded.
class TransactionTimeout < StatementInvalid
# LockWaitTimeout will be raised when lock wait timeout exceeded.
class LockWaitTimeout < StatementInvalid
end

# StatementTimeout will be raised when statement timeout exceeded.
Expand Down
4 changes: 2 additions & 2 deletions activerecord/test/cases/adapters/mysql2/transaction_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ class Sample < ActiveRecord::Base
end
end

test "raises TransactionTimeout when lock wait timeout exceeded" do
assert_raises(ActiveRecord::TransactionTimeout) do
test "raises LockWaitTimeout when lock wait timeout exceeded" do
assert_raises(ActiveRecord::LockWaitTimeout) do
s = Sample.create!(value: 1)
latch1 = Concurrent::CountDownLatch.new
latch2 = Concurrent::CountDownLatch.new
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,9 @@ class Sample < ActiveRecord::Base
end
end

test "raises TransactionTimeout when lock wait timeout exceeded" do
test "raises LockWaitTimeout when lock wait timeout exceeded" do
skip unless ActiveRecord::Base.connection.postgresql_version >= 90300
assert_raises(ActiveRecord::TransactionTimeout) do
assert_raises(ActiveRecord::LockWaitTimeout) do
s = Sample.create!(value: 1)
latch1 = Concurrent::CountDownLatch.new
latch2 = Concurrent::CountDownLatch.new
Expand Down