Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Changeset 3046

Show
Ignore:
Timestamp:
11/15/05 22:16:15 (3 years ago)
Author:
minam
Message:

Make deadlock-retry plugin work with recent changes to MySQL error messages

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • plugins/deadlock_retry/lib/deadlock_retry.rb

    r2808 r3046  
    4545        transaction_without_deadlock_handling(*objects, &block) 
    4646      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)}/ } 
    4848          raise if retry_count >= MAXIMUM_RETRIES_ON_DEADLOCK 
    4949          retry_count += 1 
  • plugins/deadlock_retry/README

    r2808 r3046  
    22============== 
    33 
    4 Deadlock retry allows the database adapter (currently only tested with the MySQLAdapter) to retry 
    5 transactions that fall into deadlock. It will retry such transactions three times before finall
    6 failing. 
     4Deadlock retry allows the database adapter (currently only tested with the 
     5MySQLAdapter) to retry transactions that fall into deadlock. It will retr
     6such transactions three times before finally failing. 
    77 
    8 This capability is automatically added to ActiveRecord. No code changes or otherwise is required. 
     8This capability is automatically added to ActiveRecord. No code changes or otherwise are required. 
    99 
    1010Copyright (c) 2005 Jamis Buck, released under the MIT license 
  • plugins/deadlock_retry/test/deadlock_retry_test.rb

    r2808 r3046  
    3333 
    3434class 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" 
    3737 
    3838  def test_no_errors