Changeset 1483

Show
Ignore:
Timestamp:
04/08/08 13:24:01 (5 months ago)
Author:
dbryson
Message:


Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • hive/trunk/worker_bee/lib/worker_bee.rb

    r1480 r1483  
    33    attr_reader :hive, :config 
    44     
    5     def initialize 
     5    def initialize(config) 
    66      begin 
    7         f = "#{RAILS_ROOT}/config/workerbee.yml" 
    8         @config = YAML.load_file(f) 
     7        @config = config 
    98      rescue SystemCallError 
    109        raise "Couldn't find or read the conf/worker.yml file. Tried: #{f}" 
     
    4039    def ping? 
    4140      begin 
    42         #RestClient.get(@config['ping_url'], setup_header) 
    4341        get(@config['ping_url']) 
    4442        return true 
     
    5856        #STDOUT.print "Job to process!" 
    5957         
    60         encoded_data = ActiveSupport::JSON.encode(job[1]) 
    61         #form_data = "data=#{encoded_data}" 
     58        encoded_data = ActiveSupport::JSON.encode(job.job_data) 
    6259        begin 
    6360          # Set the url based on the type 
    64           #RestClient.post( @config[job_type], form_data, setup_header) 
    65           post(@config[job[0]],encoded_data) 
     61          post(@config[job.job_type],encoded_data) 
    6662          job.destroy # Remove the job from the database 
    6763        rescue Exception => e 
     
    7975        end 
    8076         
    81         sleep(2) # 5 minutes 
     77        sleep(5*60) # 5 minutes 
    8278      end 
    8379    end