diff options
author | Ryuta Kamizono <kamipo@gmail.com> | 2017-11-11 19:53:40 +0900 |
---|---|---|
committer | Ryuta Kamizono <kamipo@gmail.com> | 2017-11-11 19:53:40 +0900 |
commit | 4a65dfcb9adae8fb12a86521c1a34b392e6084c2 (patch) | |
tree | b5c97722ffc168327b5fc594a1c8620b5437edcd /activerecord/lib | |
parent | ee5cf14ab06c366b37a6339f2af7c41457b3557b (diff) | |
download | rails-4a65dfcb9adae8fb12a86521c1a34b392e6084c2.tar.gz rails-4a65dfcb9adae8fb12a86521c1a34b392e6084c2.tar.bz2 rails-4a65dfcb9adae8fb12a86521c1a34b392e6084c2.zip |
Raise `TransactionTimeout` when lock wait timeout exceeded for PG adapter
Follow up of #30360.
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb index 2c3c1df2a9..46863c41ab 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb @@ -391,6 +391,7 @@ module ActiveRecord UNIQUE_VIOLATION = "23505" SERIALIZATION_FAILURE = "40001" DEADLOCK_DETECTED = "40P01" + LOCK_NOT_AVAILABLE = "55P03" def translate_exception(exception, message) return exception unless exception.respond_to?(:result) @@ -410,6 +411,8 @@ module ActiveRecord SerializationFailure.new(message) when DEADLOCK_DETECTED Deadlocked.new(message) + when LOCK_NOT_AVAILABLE + TransactionTimeout.new(message) else super end |