class SidekiqUniqueJobs::Lock::UntilAndWhileExecuting

@author Mikael Henriksson <mikael@zoolutions.se>
See {#execute} for more information about the server
See {#lock} for more information about the client.
- Unlocks after yielding to the worker’s perform method (see {WhileExecuting})
- Locks before yielding to the worker’s perform method (see {WhileExecuting})
- Unlocks before yielding to the worker’s perform method (see {UntilExecuting})
- Locks on perform_in or perform_async (see {UntilExecuting})
Locks jobs while the job is executing in the server process

def execute

Other tags:
    Yield: - to the worker class perform method
def execute
  if unlock
    lock_on_failure do
      runtime_lock.execute { return yield }
    end
  else
    log_warn "couldn't unlock digest: #{item[LOCK_DIGEST]} #{item[JID]}"
  end
end

def lock_on_failure

def lock_on_failure
  yield
rescue Exception # rubocop:disable Lint/RescueException
  log_error("Runtime lock failed to execute job, restoring server lock")
  lock
  raise
end

def runtime_lock

def runtime_lock
  @runtime_lock ||= SidekiqUniqueJobs::Lock::WhileExecuting.new(item, callback, redis_pool)
end