Sha256: d821bafe1532e882b74df0fb614a40e3fedf2d6de2574c7c8c4346e59ecee73c

Contents?: true

Size: 453 Bytes

Versions: 5

Compression:

Stored size: 453 Bytes

Contents

require 'twitter'

module Resque
  module Plugins
    module RateLimitedQueue
      class TwitterQueue < BaseApiQueue
        @queue = :twitter_api

        def self.perform(klass, *params)
          super
        rescue Twitter::Error::TooManyRequests,
               Twitter::Error::EnhanceYourCalm => e
          pause_for(Time.now + e.rate_limit.reset_in)
          rate_limited_requeue(self, klass, *params)
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
resque-rate_limited_queue-0.0.34 lib/resque/plugins/rate_limited_queue/apis/twitter_queue.rb
resque-rate_limited_queue-0.0.33 lib/resque/plugins/rate_limited_queue/apis/twitter_queue.rb
resque-rate_limited_queue-0.0.32 lib/resque/plugins/rate_limited/apis/twitter_queue.rb
resque-rate_limited_queue-0.0.31 lib/resque/plugins/rate_limited/apis/twitter_queue.rb
resque-rate_limited_queue-0.0.30 lib/resque/plugins/rate_limited/apis/twitter_queue.rb