Changeset 1483
- Timestamp:
- 04/08/08 13:24:01 (5 months ago)
- Files:
-
- hive/trunk/worker_bee/lib/worker_bee.rb (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
hive/trunk/worker_bee/lib/worker_bee.rb
r1480 r1483 3 3 attr_reader :hive, :config 4 4 5 def initialize 5 def initialize(config) 6 6 begin 7 f = "#{RAILS_ROOT}/config/workerbee.yml" 8 @config = YAML.load_file(f) 7 @config = config 9 8 rescue SystemCallError 10 9 raise "Couldn't find or read the conf/worker.yml file. Tried: #{f}" … … 40 39 def ping? 41 40 begin 42 #RestClient.get(@config['ping_url'], setup_header)43 41 get(@config['ping_url']) 44 42 return true … … 58 56 #STDOUT.print "Job to process!" 59 57 60 encoded_data = ActiveSupport::JSON.encode(job[1]) 61 #form_data = "data=#{encoded_data}" 58 encoded_data = ActiveSupport::JSON.encode(job.job_data) 62 59 begin 63 60 # 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) 66 62 job.destroy # Remove the job from the database 67 63 rescue Exception => e … … 79 75 end 80 76 81 sleep( 2) # 5 minutes77 sleep(5*60) # 5 minutes 82 78 end 83 79 end
