Sha256: b00b8a592a690491b847509900de02230eec1f796e4dfa1e7ea6b6425a3cd45a

Contents?: true

Size: 909 Bytes

Versions: 5

Compression:

Stored size: 909 Bytes

Contents

module Resque
  module Plugins
    module RateLimitedQueue
      class UnPause
        @queue = nil

        class << self
          attr_writer(:queue)

          def use?
            Resque.respond_to?(:enqueue_at_with_queue) && @queue
          end

          def enqueue(timestamp, klass)
            # If Resque scheduler is installed and queue is set - use it to queue a wake up job
            return unless use?
            Resque.enqueue_at_with_queue(
              @queue,
              timestamp,
              Resque::Plugins::RateLimitedQueue::UnPause,
              klass)
          end

          def perform(klass)
            class_from_string(klass.to_s).un_pause
          end

          def class_from_string(str)
            str.split('::').reduce(Object) do |mod, class_name|
              mod.const_get(class_name)
            end
          end
        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/rate_limited_un_pause.rb
resque-rate_limited_queue-0.0.33 lib/resque/plugins/rate_limited_queue/rate_limited_un_pause.rb
resque-rate_limited_queue-0.0.32 lib/resque/plugins/rate_limited/rate_limited_un_pause.rb
resque-rate_limited_queue-0.0.31 lib/resque/plugins/rate_limited/rate_limited_un_pause.rb
resque-rate_limited_queue-0.0.30 lib/resque/plugins/rate_limited/rate_limited_un_pause.rb