Changeset 3046
- Timestamp:
- 11/15/05 22:16:15 (3 years ago)
- Files:
-
- plugins/deadlock_retry/lib/deadlock_retry.rb (modified) (1 diff)
- plugins/deadlock_retry/README (modified) (1 diff)
- plugins/deadlock_retry/test/deadlock_retry_test.rb (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
plugins/deadlock_retry/lib/deadlock_retry.rb
r2808 r3046 45 45 transaction_without_deadlock_handling(*objects, &block) 46 46 rescue ActiveRecord::StatementInvalid => error 47 if DEADLOCK_ERROR_MESSAGES.any? { |msg| error.message =~ / ^#{msg}/ }47 if DEADLOCK_ERROR_MESSAGES.any? { |msg| error.message =~ /#{Regexp.escape(msg)}/ } 48 48 raise if retry_count >= MAXIMUM_RETRIES_ON_DEADLOCK 49 49 retry_count += 1 plugins/deadlock_retry/README
r2808 r3046 2 2 ============== 3 3 4 Deadlock retry allows the database adapter (currently only tested with the MySQLAdapter) to retry5 transactions that fall into deadlock. It will retry such transactions three times before finally6 failing.4 Deadlock retry allows the database adapter (currently only tested with the 5 MySQLAdapter) to retry transactions that fall into deadlock. It will retry 6 such transactions three times before finally failing. 7 7 8 This capability is automatically added to ActiveRecord. No code changes or otherwise isrequired.8 This capability is automatically added to ActiveRecord. No code changes or otherwise are required. 9 9 10 10 Copyright (c) 2005 Jamis Buck, released under the MIT license plugins/deadlock_retry/test/deadlock_retry_test.rb
r2808 r3046 33 33 34 34 class DeadlockRetryTest < Test::Unit::TestCase 35 DEADLOCK_ERROR = " Deadlock found when trying to get lock"36 TIMEOUT_ERROR = " Lock wait timeout exceeded"35 DEADLOCK_ERROR = "MySQL::Error: Deadlock found when trying to get lock" 36 TIMEOUT_ERROR = "MySQL::Error: Lock wait timeout exceeded" 37 37 38 38 def test_no_errors