Skip to content

Commit

Permalink
simple deadlock retry
Browse files Browse the repository at this point in the history
  • Loading branch information
Nick Gauthier committed Apr 22, 2010
1 parent 7853940 commit 2750fa4
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions lib/hydra/master.rb
Expand Up @@ -83,13 +83,18 @@ def send_file(worker)

# Process the results coming back from the worker.
def process_results(worker, message)
@incomplete_files.delete_at(@incomplete_files.index(message.file))
trace "#{@incomplete_files.size} Files Remaining"
@event_listeners.each{|l| l.file_end(message.file, message.output) }
if @incomplete_files.empty?
shutdown_all_workers
if message.output =~ /ActiveRecord::StatementInvalid(.*)[Dd]eadlock/
trace "Deadlock detected running [#{message.file}]. Will retry at the end"
@files.push(message.file)
else
send_file(worker)
@incomplete_files.delete_at(@incomplete_files.index(message.file))
trace "#{@incomplete_files.size} Files Remaining"
@event_listeners.each{|l| l.file_end(message.file, message.output) }
if @incomplete_files.empty?
shutdown_all_workers
else
send_file(worker)
end
end
end

Expand Down

0 comments on commit 2750fa4

Please sign in to comment.