Sha256: 4e052251076f662d5baa543d29a4dafc5826f28e59c042b69efb74c92127e2df

Contents?: true

Size: 725 Bytes

Versions: 1

Compression:

Stored size: 725 Bytes

Contents

require 'sidekiq/worker'

module DelayedPaperclip
  module Jobs
    class Sidekiq
      include ::Sidekiq::Worker

      def self.enqueue_delayed_paperclip(instance_klass, instance_id, attachment_name)
        queue_name = instance_klass.constantize.paperclip_definitions[attachment_name][:delayed][:queue]
        # Sidekiq >= 4.1.0
        if respond_to?(:set)
          set(:queue => queue_name)
        else
          sidekiq_options :queue => queue_name
        end
        perform_async(instance_klass, instance_id, attachment_name)
      end

      def perform(instance_klass, instance_id, attachment_name)
        DelayedPaperclip.process_job(instance_klass, instance_id, attachment_name)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
delayed_paperclip-2.9.2 lib/delayed_paperclip/jobs/sidekiq.rb