Module: SidekiqUniqueJobs::Job

Extended by:
Job
Included in:
Job
Defined in:
lib/sidekiq_unique_jobs/job.rb

Overview

Utility class to append uniqueness to the sidekiq job hash

Author:

Instance Method Summary collapse

Instance Method Details

#add_digest(item) ⇒ Hash

Adds lock_args, lock_prefix and lock_digest to the sidekiq job hash

Returns:

  • (Hash)

    the job hash



21
22
23
24
25
26
27
# File 'lib/sidekiq_unique_jobs/job.rb', line 21

def add_digest(item)
  add_lock_prefix(item)
  add_lock_args(item)
  add_lock_digest(item)

  item
end

#prepare(item) ⇒ Hash

Adds timeout, expiration, lock_args, lock_prefix and lock_digest to the sidekiq job hash

Returns:

  • (Hash)

    the job hash



12
13
14
15
16
17
# File 'lib/sidekiq_unique_jobs/job.rb', line 12

def prepare(item)
  stringify_on_conflict_hash(item)
  add_lock_timeout(item)
  add_lock_ttl(item)
  add_digest(item)
end