lib/dumper/agent.rb in dumper-1.0.2 vs lib/dumper/agent.rb in dumper-1.1.0
- old
+ new
@@ -4,12 +4,13 @@
module Dumper
class Agent
include Dumper::Utility::LoggingMethods
API_VERSION = 1
+ MAX_FILESIZE = 2.gigabytes
- attr_reader :stack
+ attr_reader :stack, :max_filesize
class << self
def start(options = {})
if defined?(Rails::Railtie)
ActiveSupport.on_load :after_initialize do
@@ -58,10 +59,12 @@
end until json[:status]
return log("agent stopped: #{json.to_s}") if json[:status] == 'error'
@token = json[:token]
- log "agent started as #{@token ? 'primary' : 'secondary'}"
+ @max_filesize = (json[:max_filesize] || MAX_FILESIZE).to_i
+ log "agent started as #{@token ? 'primary' : 'secondary'}, max_filesize = #{@max_filesize}"
+
sleep 1.hour + rand(10) unless @token
loop do
json = api_request('agent/poll', :params => { :token => @token })