aboutsummaryrefslogblamecommitdiffstats
path: root/lib/active_job/queue_adapters/sneakers_adapter.rb
blob: ae9e49a0bf5e034b4b220c42b24c8369f1f705ee (plain) (tree)
1
2
3
4
5
6
7
8
9








                                          



                                           






                                    

                                                       




           
require 'sneakers'

module ActiveJob
  module QueueAdapters
    class SneakersAdapter
      class << self
        def queue(job, *args)
          JobWrapper.enqueue([job, *args])
        end

        def queue_at(job, timestamp, *args)
          raise NotImplementedError
        end
      end

      class JobWrapper
        include Sneakers::Worker

        self.from_queue("queue", {})

        def work(job, *args)
          job.new.perform *Parameters.deserialize(args)
        end
      end
    end
  end
end