Module: Sidekiq::JobSet::UniqueExtension

Included in:
Sidekiq::JobSet
Defined in:
lib/sidekiq_unique_jobs/sidekiq_unique_ext.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object


88
89
90
91
92
93
94
95
96
97
98
99
100
# File 'lib/sidekiq_unique_jobs/sidekiq_unique_ext.rb', line 88

def self.included(base)
  base.class_eval do
    if base.method_defined?(:clear)
      alias_method :clear_orig, :clear
      alias_method :clear, :clear_ext
    end

    if base.method_defined?(:delete_by_value)
      alias_method :delete_by_value_orig, :delete_by_value
      alias_method :delete_by_value, :delete_by_value_ext
    end
  end
end

Instance Method Details

#clear_extObject


102
103
104
105
# File 'lib/sidekiq_unique_jobs/sidekiq_unique_ext.rb', line 102

def clear_ext
  each(&:delete)
  clear_orig
end

#delete_by_value_ext(name, value) ⇒ Object


107
108
109
# File 'lib/sidekiq_unique_jobs/sidekiq_unique_ext.rb', line 107

def delete_by_value_ext(name, value)
  SidekiqUniqueJobs::Unlockable.unlock(Sidekiq.load_json(value)) if delete_by_value_orig(name, value)
end