Sha256: dfb2fe77447a01da82f13e1e8d972c7a9b8f7754b018e4408b18807ac31fc2d8
Contents?: true
Size: 1.31 KB
Versions: 7
Compression:
Stored size: 1.31 KB
Contents
require 'sidekiq/api' module Sidekiq class Job module UniqueExtension def self.included(base) base.class_eval do alias_method :delete_orig, :delete alias_method :delete, :delete_ext end end def delete_ext unlock(payload_hash(item)) delete_orig end protected def payload_hash(item) SidekiqUniqueJobs::PayloadHelper.get_payload(item['class'], item['queue'], item['args']) end def unlock(payload_hash) Sidekiq.redis { |conn| conn.del(payload_hash) } end end include UniqueExtension end class Queue module UniqueExtension def self.included(base) base.class_eval do alias_method :clear_orig, :clear alias_method :clear, :clear_ext end end def clear_ext each(&:delete) clear_orig end end include UniqueExtension end class JobSet module UniqueExtension def self.included(base) base.class_eval do if base.method_defined?(:clear) alias_method :clear_orig, :clear alias_method :clear, :clear_ext end end end def clear_ext each(&:delete_ext) clear_orig end end include UniqueExtension end end
Version data entries
7 entries across 7 versions & 1 rubygems