Sha256: 0b4d7f86d296e1efa505de9726716409cd6aed0cb2340387bf6751bdd9cc9d12

Contents?: true

Size: 797 Bytes

Versions: 24

Compression:

Stored size: 797 Bytes

Contents

# frozen_string_literal: true

module SidekiqUniqueJobs
  # Utility module to help manage unique keys in redis.
  # Useful for deleting keys that for whatever reason wasn't deleted
  #
  # @author Mikael Henriksson <mikael@zoolutions.se>
  module Unlockable
    module_function

    # Unlocks a job.
    # @param [Hash] item a Sidekiq job hash
    def unlock(item)
      SidekiqUniqueJobs::UniqueArgs.digest(item)
      SidekiqUniqueJobs::Locksmith.new(item).unlock
    end

    # Deletes a lock regardless of if it was locked or not.
    #
    # This is good for situations when a job is locked by another item
    # @param [Hash] item a Sidekiq job hash
    def delete(item)
      SidekiqUniqueJobs::UniqueArgs.digest(item)
      SidekiqUniqueJobs::Locksmith.new(item).delete!
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
sidekiq-unique-jobs-6.0.25 lib/sidekiq_unique_jobs/unlockable.rb
sidekiq-unique-jobs-6.0.24 lib/sidekiq_unique_jobs/unlockable.rb
sidekiq-unique-jobs-6.0.23 lib/sidekiq_unique_jobs/unlockable.rb
sidekiq-unique-jobs-6.0.22 lib/sidekiq_unique_jobs/unlockable.rb
sidekiq-unique-jobs-6.0.21 lib/sidekiq_unique_jobs/unlockable.rb
sidekiq-unique-jobs-6.0.20 lib/sidekiq_unique_jobs/unlockable.rb
sidekiq-unique-jobs-6.0.16 lib/sidekiq_unique_jobs/unlockable.rb
sidekiq-unique-jobs-6.0.19 lib/sidekiq_unique_jobs/unlockable.rb
sidekiq-unique-jobs-6.0.13 lib/sidekiq_unique_jobs/unlockable.rb
sidekiq-unique-jobs-6.0.12 lib/sidekiq_unique_jobs/unlockable.rb
sidekiq-unique-jobs-6.0.11 lib/sidekiq_unique_jobs/unlockable.rb
sidekiq-unique-jobs-6.0.10 lib/sidekiq_unique_jobs/unlockable.rb
sidekiq-unique-jobs-6.0.9 lib/sidekiq_unique_jobs/unlockable.rb
sidekiq-unique-jobs-6.0.8 lib/sidekiq_unique_jobs/unlockable.rb
sidekiq-unique-jobs-6.0.7 lib/sidekiq_unique_jobs/unlockable.rb
sidekiq-unique-jobs-6.0.6 lib/sidekiq_unique_jobs/unlockable.rb
sidekiq-unique-jobs-6.0.5 lib/sidekiq_unique_jobs/unlockable.rb
sidekiq-unique-jobs-6.0.4 lib/sidekiq_unique_jobs/unlockable.rb
sidekiq-unique-jobs-6.0.3 lib/sidekiq_unique_jobs/unlockable.rb
sidekiq-unique-jobs-6.0.2 lib/sidekiq_unique_jobs/unlockable.rb