# File lib/hydra/master.rb, line 114
    def process_results(worker, message)
      if message.output =~ /ActiveRecord::StatementInvalid(.*)[Dd]eadlock/ or
         message.output =~ /PGError: ERROR(.*)[Dd]eadlock/ or
         message.output =~ /Mysql::Error: SAVEPOINT(.*)does not exist: ROLLBACK/ or
         message.output =~ /Mysql::Error: Deadlock found/
        trace "Deadlock detected running [#{message.file}]. Will retry at the end"
        @files.push(message.file)
        send_file(worker)
      else
        @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) }
        unless message.output == '.'
          @failed_files << message.file
        end
        if @incomplete_files.empty?
          @workers.each do |worker|
            @event_listeners.each{|l| l.worker_end(worker) }
          end

          shutdown_all_workers
        else
          send_file(worker)
        end
      end
    end