Module: Resque::Plugins::UniqueJob::ClassMethods
- Defined in:
- lib/resque_solo/unique_job.rb
Instance Method Summary collapse
-
#lock_after_execution_period ⇒ Object
The default ttl of a persisting key is 0, i.e.
-
#redis_key(payload) ⇒ Object
Payload is what Resque stored for this job along with the job’s class name: a hash containing :class and :args.
-
#ttl ⇒ Object
The default ttl of a locking key is -1 (forever).
Instance Method Details
#lock_after_execution_period ⇒ Object
45 46 47 |
# File 'lib/resque_solo/unique_job.rb', line 45 def lock_after_execution_period @lock_after_execution_period ||= 0 end |
#redis_key(payload) ⇒ Object
Payload is what Resque stored for this job along with the job’s class name: a hash containing :class and :args
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/resque_solo/unique_job.rb', line 13 def redis_key(payload) payload = Resque.decode(Resque.encode(payload)) job = payload["class"] args = payload["args"] args.map! do |arg| arg.is_a?(Hash) ? arg.sort : arg end Digest::MD5.hexdigest Resque.encode(class: job, args: args) end |