Sha256: ccad78392c4df64e5ff336ccd3b8a4fdb6a242665e728df24d2a05cd9fde3049
Contents?: true
Size: 702 Bytes
Versions: 21
Compression:
Stored size: 702 Bytes
Contents
# Retryable Typheous # Inspiration: https://gist.github.com/kunalmodi/2939288 # Patches the request and hydra to allow requests to get resend when they fail module RetryableTyphoeus require 'typhoeus' include Typhoeus DEFAULT_RETRIES = 10 class Request < Typhoeus::Request attr_accessor :retries def initialize(base_url, options = {}) @retries = (options.delete(:retries) || DEFAULT_RETRIES) super end def finish(response, bypass_memoization = nil) if response.success? || @retries <= 0 super else @retries -= 1 if @hydra @hydra.queue_front self else run end end end end end
Version data entries
21 entries across 21 versions & 1 rubygems