Skip to content

Commit

Permalink
Adds documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
mhenrixon committed Sep 27, 2021
1 parent 8de220a commit 59b1c14
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions lib/sidekiq_unique_jobs/lock/base_lock.rb
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,13 @@ def locksmith
# @return [Integer] the current locking attempt
attr_reader :attempt

#
# Eases testing by allowing the lock implementation to add the missing
# keys to the job hash.
#
#
# @return [void] the return value should be irrelevant
#
def prepare_item
return if item.key?(LOCK_DIGEST)

Expand All @@ -99,6 +106,16 @@ def prepare_item
SidekiqUniqueJobs::Job.prepare(item)
end

#
# Call whatever strategry that has been configured
#
# @param [Symbol] origin: the origin `:client` or `:server`
#
# @return [void] the return value is irrelevant
#
# @yieldparam [void] if a new job id was set and a block is given
# @yieldreturn [void] the yield is irrelevant, it only provides a mechanism in
# one specific situation to yield back to the middleware.
def call_strategy(origin:)
new_job_id = nil
strategy = strategy_for(origin)
Expand Down

0 comments on commit 59b1c14

Please sign in to comment.