Sha256: 044463f4355d95296ca8a6fb7a3b5c4b96f410f3fcd999cd208ada8927de3557

Contents?: true

Size: 582 Bytes

Versions: 1

Compression:

Stored size: 582 Bytes

Contents

module Resque
  class ThrottledJob

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

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

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

    def self.key
      [self.to_s, identifier].compact.join(":")
    end

    def self.can_run_every
      settings[:can_run_every]
    end
    
    def self.disabled
      settings[:disabled]
    end
    
    def self.identifier
      settings[:identifier]
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
resque-throttle-0.2.6 lib/resque/throttled_job.rb