Sha256: 096642dc4c45cccd2e05dfa89f691589cf8abbb60cc663c4d4b6d375071256a9

Contents?: true

Size: 722 Bytes

Versions: 17

Compression:

Stored size: 722 Bytes

Contents

module CanvasSync::JobUniqueness
  module OnConflict
    class Reject < Base
      valid_for :perform

      def call
        # TODO Allow this to work on Sidekiq-backed ActiveJob
        unless lock_context.is_a?(CanvasSync::JobUniqueness::Compat::Sidekiq::SidekiqLockContext)
          CanvasSync::JobUniqueness.logger.error(":reject conflict strategy is not supported for non-Sidekiq-backed jobs")
          return
        end

        kwargs = {}
        kwargs[:notify_failure] = false if Sidekiq::DeadSet.instance_method(:kill).arity > 1

        sidekiq_message = lock_context.instance_variable_get(:@job_instance)
        Sidekiq::DeadSet.new.kill(JSON.dump(sidekiq_message), **kwargs)
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
canvas_sync-0.22.9 lib/canvas_sync/job_uniqueness/on_conflict/reject.rb
canvas_sync-0.22.8 lib/canvas_sync/job_uniqueness/on_conflict/reject.rb
canvas_sync-0.22.6 lib/canvas_sync/job_uniqueness/on_conflict/reject.rb
canvas_sync-0.22.5 lib/canvas_sync/job_uniqueness/on_conflict/reject.rb
canvas_sync-0.22.4 lib/canvas_sync/job_uniqueness/on_conflict/reject.rb
canvas_sync-0.22.3 lib/canvas_sync/job_uniqueness/on_conflict/reject.rb
canvas_sync-0.22.2 lib/canvas_sync/job_uniqueness/on_conflict/reject.rb
canvas_sync-0.22.1 lib/canvas_sync/job_uniqueness/on_conflict/reject.rb
canvas_sync-0.22.0 lib/canvas_sync/job_uniqueness/on_conflict/reject.rb
canvas_sync-0.22.0.beta8 lib/canvas_sync/job_uniqueness/on_conflict/reject.rb
canvas_sync-0.22.0.beta7 lib/canvas_sync/job_uniqueness/on_conflict/reject.rb
canvas_sync-0.22.0.beta6 lib/canvas_sync/job_uniqueness/on_conflict/reject.rb
canvas_sync-0.22.0.beta5 lib/canvas_sync/job_uniqueness/on_conflict/reject.rb
canvas_sync-0.22.0.beta4 lib/canvas_sync/job_uniqueness/on_conflict/reject.rb
canvas_sync-0.22.0.beta3 lib/canvas_sync/job_uniqueness/on_conflict/reject.rb
canvas_sync-0.22.0.beta2 lib/canvas_sync/job_uniqueness/on_conflict/reject.rb
canvas_sync-0.22.0.beta1 lib/canvas_sync/job_uniqueness/on_conflict/reject.rb