simple deadlock retry

This commit is contained in:
Nick Gauthier 2010-04-22 16:04:09 -04:00
parent 7853940813
commit 2750fa4aaa
1 changed files with 11 additions and 6 deletions

View File

@ -83,6 +83,10 @@ module Hydra #:nodoc:
# Process the results coming back from the worker. # Process the results coming back from the worker.
def process_results(worker, message) def process_results(worker, message)
if message.output =~ /ActiveRecord::StatementInvalid(.*)[Dd]eadlock/
trace "Deadlock detected running [#{message.file}]. Will retry at the end"
@files.push(message.file)
else
@incomplete_files.delete_at(@incomplete_files.index(message.file)) @incomplete_files.delete_at(@incomplete_files.index(message.file))
trace "#{@incomplete_files.size} Files Remaining" trace "#{@incomplete_files.size} Files Remaining"
@event_listeners.each{|l| l.file_end(message.file, message.output) } @event_listeners.each{|l| l.file_end(message.file, message.output) }
@ -92,6 +96,7 @@ module Hydra #:nodoc:
send_file(worker) send_file(worker)
end end
end end
end
# A text report of the time it took to run each file # A text report of the time it took to run each file
attr_reader :report_text attr_reader :report_text