Sha256: 72fa0139eaa9d77b96292121b5ec94b56d56a1e32e5db37e70d9e3b2978911e4

Contents?: true

Size: 1.19 KB

Versions: 2

Compression:

Stored size: 1.19 KB

Contents

require 'active_support/concern'
require 'hover/client/hover'

module Hover
  module Jobs
    module Concerns
      module RetryNetworkErrors
        extend ActiveSupport::Concern
        
        included do
          @backoff_strategy = [1, 2, 3, 4, 5, 10, 20, 30, 40, 50, 60, 120, 240, 480]
          
          # http://ruby-doc.org/stdlib-1.9.2/libdoc/socket/rdoc/Socket.html
          
          @retry_exceptions = [
            Hover::Client::Unavailable,
            Timeout::Error,
            Net::ProtocolError,
            Errno::ECONNRESET,
            Errno::ECONNREFUSED,
            Errno::EALREADY,
            Errno::EFAULT,
            Errno::EHOSTUNREACH,
            Errno::EINPROGRESS,
            Errno::EINTR,
            Errno::EISCONN,
            Errno::EINVAL,
            Errno::ENETDOWN,
            Errno::ENETUNREACH,
            Errno::ENOBUFS,
            Errno::ENOSR,
            Errno::EOPNOTSUPP,
            Errno::ETIMEDOUT
          ]
          
          #
          # make sure this comes after the variables above ^
          #
          extend Resque::Plugins::ExponentialBackoff if defined?(Resque::Plugins::ExponentialBackoff)
        end
        
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
hover-ruby-client-0.4.0 lib/hover/jobs/concerns/retry_network_errors.rb
hover-ruby-client-0.3.1 lib/hover/jobs/concerns/retry_network_errors.rb