Sha256: 21fdbed6c08e261bff35fcf3a706ebeb516231eaa3dca3ca1cd5d914cb7ab1d2

Contents?: true

Size: 739 Bytes

Versions: 5

Compression:

Stored size: 739 Bytes

Contents

# frozen_string_literal: true

require 'singleton'

module RailsAutoscaleAgent
  class Config
    include Singleton

    attr_accessor :report_interval, :logger, :api_base_url, :max_request_size,
                  :dyno, :pid

    def initialize
      @api_base_url = ENV['RAILS_AUTOSCALE_URL']
      @pid = Process.pid
      @max_request_size = 100_000 # ignore request payloads over 100k since they skew the queue times
      @report_interval = 60 # this default will be overwritten during Reporter#register!
      @logger ||= defined?(Rails) ? Rails.logger : ::Logger.new(STDOUT)
      @dyno = ENV['DYNO']
    end

    def to_s
      "#{@dyno}##{@pid}"
    end

    def ignore_large_requests?
      @max_request_size
    end

  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rails_autoscale_agent-0.6.2 lib/rails_autoscale_agent/config.rb
rails_autoscale_agent-0.6.1 lib/rails_autoscale_agent/config.rb
rails_autoscale_agent-0.6.0 lib/rails_autoscale_agent/config.rb
rails_autoscale_agent-0.4.1 lib/rails_autoscale_agent/config.rb
rails_autoscale_agent-0.4.0 lib/rails_autoscale_agent/config.rb