Sha256: 7a094aeb9ceb4be89589bcfc6d3bdba3dd8f480d3d4dbbc0dba5af30915ebe96

Contents?: true

Size: 646 Bytes

Versions: 1

Compression:

Stored size: 646 Bytes

Contents

module Resque
  class SettingNotFound < RuntimeError; end

  class ThrottledJob

    THROTTLE_DEFAULTS = {
        :can_run_every => 1800,
        :disabled      => false,
    }

    def self.throttle_settings
      @throttle_settings ||= THROTTLE_DEFAULTS.dup
    end

    def self.throttle(args = {})
      throttle_settings.merge!(args)
    end

    def self.identifier(*args)
    end

    def self.key(*args)
      ['resque-throttle', self.to_s, identifier(*args)].compact.join(":")
    end

    def self.can_run_every
      throttle_settings[:can_run_every]
    end

    def self.disabled
      throttle_settings[:disabled]
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fhwang-resque-throttle-0.3.0 lib/resque/throttled_job.rb