diff options
Diffstat (limited to 'lib/active_job/queue_adapters/sneakers_adapter.rb')
-rw-r--r-- | lib/active_job/queue_adapters/sneakers_adapter.rb | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/active_job/queue_adapters/sneakers_adapter.rb b/lib/active_job/queue_adapters/sneakers_adapter.rb index ae9e49a0bf..b299b25a96 100644 --- a/lib/active_job/queue_adapters/sneakers_adapter.rb +++ b/lib/active_job/queue_adapters/sneakers_adapter.rb @@ -1,11 +1,17 @@ require 'sneakers' +require 'thread' module ActiveJob module QueueAdapters class SneakersAdapter + @mutex = Mutex.new + class << self def queue(job, *args) - JobWrapper.enqueue([job, *args]) + @mutex.synchronize do + JobWrapper.from_queue job.queue_name + JobWrapper.enqueue [ job, *args ] + end end def queue_at(job, timestamp, *args) @@ -16,8 +22,6 @@ module ActiveJob class JobWrapper include Sneakers::Worker - self.from_queue("queue", {}) - def work(job, *args) job.new.perform *Parameters.deserialize(args) end |