mperham/sidekiq — Issue #65: Synchronously performing a single job
Author: Burgestrand
Created: 2012-02-29 14:35:16+00:00
State: open

Hi,

Is it possible to perform a single job from a single queue as a synchronous operation? It’d be useful for testing workers closer to their actual environment, as well as testing that middleware actually behaves the way they should.

I’ve temporarily built a helper for this, but it’s not an ideal solution:

```ruby
def process_one_job(queue)
actor = double(:processor_done! => true)
work = MultiJson.decode(Sidekiq.redis.lpop("queue:#{queue}"))
Sidekiq::Processor.new(actor).process(work, queue)
end
```

For the above solution, if a job raises an error, a whole bulk of not-so-nice warnings will spew out and my tests will return a non-zero error status, even if I catch the error.