lib/dumper/agent.rb in dumper-0.1.1 vs lib/dumper/agent.rb in dumper-0.2.0

- old
+ new

@@ -18,11 +18,11 @@ start(options) if yield end end def initialize(options = {}) - log '**** Dumper requires :app_key! ****' if options[:app_key].blank? + log 'app_key is missing' if options[:app_key].blank? @stack = Dumper::Stack.new @api_base = options[:api_base] || 'http://dumper.io' @app_key = options[:app_key] @app_env = @stack.rails_env @@ -49,10 +49,10 @@ return log("agent stopped: #{json.to_s}") if json[:status] == 'error' @token = json[:token] log "agent started as #{@token ? 'primary' : 'secondary'}" - sleep 1.hour unless @token + sleep 1.hour + rand(10) unless @token loop do json = api_request('agent/poll', :params => { :token => @token }) if json[:status] == 'ok'