Sha256: 518dffec7c08740f19e535b23b49b4399b6d5fde0313714c1f212f085b82bfd3

Contents?: true

Size: 684 Bytes

Versions: 7

Compression:

Stored size: 684 Bytes

Contents

# frozen_string_literal: true

module SidekiqUniqueJobs
  module OnConflict
    # Strategy to reschedule job on conflict
    #
    # @author Mikael Henriksson <mikael@zoolutions.se>
    class Reschedule < OnConflict::Strategy
      include SidekiqUniqueJobs::SidekiqWorkerMethods

      # @param [Hash] item sidekiq job hash
      def initialize(item, redis_pool = nil)
        super(item, redis_pool)
        @worker_class = item[CLASS]
      end

      # Create a new job from the current one.
      #   This will mess up sidekiq stats because a new job is created
      def call
        worker_class&.perform_in(5, *item[ARGS]) if sidekiq_worker_class?
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
sidekiq-unique-jobs-7.0.0.beta8 lib/sidekiq_unique_jobs/on_conflict/reschedule.rb
sidekiq-unique-jobs-7.0.0.beta7 lib/sidekiq_unique_jobs/on_conflict/reschedule.rb
sidekiq-unique-jobs-7.0.0.beta6 lib/sidekiq_unique_jobs/on_conflict/reschedule.rb
sidekiq-unique-jobs-7.0.0.beta5 lib/sidekiq_unique_jobs/on_conflict/reschedule.rb
sidekiq-unique-jobs-7.0.0.beta4 lib/sidekiq_unique_jobs/on_conflict/reschedule.rb
sidekiq-unique-jobs-7.0.0.beta3 lib/sidekiq_unique_jobs/on_conflict/reschedule.rb
sidekiq-unique-jobs-7.0.0.beta2 lib/sidekiq_unique_jobs/on_conflict/reschedule.rb