Sha256: eb8be6ff1f74bf41279b9fbd6789ffe7f949123ed30a5e48a8bd170e032f277d

Contents?: true

Size: 949 Bytes

Versions: 3

Compression:

Stored size: 949 Bytes

Contents

module TwitterRetry
  require "active_support/configurable"

  DEFAULT_RETRYABLE_ERRORS = [
    [Twitter::Error::ServiceUnavailable,  "Over capacity"],
    [Twitter::Error::InternalServerError, "Internal error"],
    [Twitter::Error,                      "getaddrinfo: Name or service not known"],
  ]

  DEFAULT_IGNORABLE_ERRORS = [
    [Twitter::Error::Forbidden, "Status is a duplicate."],
    [Twitter::Error::Forbidden, "User is over daily status update limit."],
    [Twitter::Error::Forbidden, "This request looks like it might be automated."],
  ]

  class Config
    include ActiveSupport::Configurable

    config_accessor :max_retry_count, :sleep_second
    config_accessor :retryable_errors, :ignorable_errors

    configure do |config|
      config.max_retry_count  = 3
      config.sleep_second     = 1
      config.retryable_errors = DEFAULT_RETRYABLE_ERRORS
      config.ignorable_errors = DEFAULT_IGNORABLE_ERRORS
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
twitter_retry-0.2.0 lib/twitter_retry/config.rb
twitter_retry-0.1.0 lib/twitter_retry/config.rb
twitter_retry-0.1.0.beta1 lib/twitter_retry/config.rb