Module: Resque::Integration::Unique::Overrides

Defined in:
lib/resque/integration/unique.rb

Instance Method Summary collapse

Instance Method Details

#enqueue(*args) ⇒ Object

Overriding enqueue method here so now it returns existing metadata if job already queued



37
38
39
40
41
42
43
# File 'lib/resque/integration/unique.rb', line 37

def enqueue(*args) #:nodoc:
  meta = enqueued?(*args)
  return meta if meta

  # enqueue job and retrieve its meta
  super
end

#meta_id(*args) ⇒ Object

Overriding meta_id here so now it generates the same MetaID for Jobs with same args



46
47
48
# File 'lib/resque/integration/unique.rb', line 46

def meta_id(*args)
  ::Digest::SHA1.hexdigest([secret_token, self, lock_on.call(*args)].join)
end