Sha256: 372df241c14a9d04a20e28f772e8312068618c6ce72e1240cfa9f1e8534749d4
Contents?: true
Size: 1009 Bytes
Versions: 13
Compression:
Stored size: 1009 Bytes
Contents
# frozen_string_literal: true module SidekiqUniqueJobs module OnConflict # Strategy to reschedule job on conflict # # @author Mikael Henriksson <mikael@mhenrixon.com> class Reschedule < OnConflict::Strategy include SidekiqUniqueJobs::SidekiqWorkerMethods include SidekiqUniqueJobs::Logging include SidekiqUniqueJobs::JSON include SidekiqUniqueJobs::Reflectable # @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 if sidekiq_worker_class? if worker_class.perform_in(5, *item[ARGS]) reflect(:rescheduled, item) else reflect(:reschedule_failed, item) end else reflect(:unknown_sidekiq_worker, item) end end end end end
Version data entries
13 entries across 13 versions & 1 rubygems