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



130
131
132
133
134
135
136
137
138
139
140
141
142
143
# File 'lib/sidekiq_unique_jobs/sidekiq_unique_ext.rb', line 130

def self.included(base)
  base.class_eval do
    include UnlockMethod
    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



145
146
147
148
# File 'lib/sidekiq_unique_jobs/sidekiq_unique_ext.rb', line 145

def clear_ext
  each(&:delete)
  clear_orig
end

#delete_by_value_ext(name, value) ⇒ Object



150
151
152
# File 'lib/sidekiq_unique_jobs/sidekiq_unique_ext.rb', line 150

def delete_by_value_ext(name, value)
  unlock(JSON.parse(value)) if delete_by_value_orig(name, value)
end