Changeset 291

Show
Ignore:
Timestamp:
12/19/07 13:05:24 (8 months ago)
Author:
gethema..@gmail.com
Message:

check in code that fixes issue with defer and passed blocks

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/server/meta_worker.rb

    r290 r291  
    1717  class WorkData 
    1818    attr_accessor :data,:block 
    19     def initialize(*args,&block) 
     19    def initialize(args,&block) 
    2020      @data = args 
    2121      @block = block 
     
    6464          task = @work_queue.pop 
    6565          @running_tasks << task 
    66           if task.data && !task.data.empty? 
    67             task.block.call(*(task.data)) 
    68           else 
    69             task.block.call 
     66          block_arity = task.block.arity 
     67          begin 
     68            block_arity == 0 ? task.block.call : task.block.call(*(task.data)) 
     69          rescue 
     70            logger.info($!.to_s) 
     71            logger.info($!.backtrace.join("\n")) 
    7072          end 
    7173          @running_tasks.pop 
     
    8082      else 
    8183        # puts "going to sleep for a while" 
    82         # sleep(2
     84        sleep(0.05
    8385        return 
    8486      end