views:

19

answers:

1

I am using delayed_job for background tasks such as system e-mails and different timed events. I use Delayed::Worker.new.work_off to work off the events in my RSpec tests, but then the test out put gets littered with sh*t like:

[Worker(host:ch.local pid:24307)] RPM Monitoring DJ worker host:ch.local pid:24307 
[Worker(host:ch.local pid:24307)] acquired lock on ListingJob
[Worker(host:ch.local pid:24307)] ListingJob completed after 0.0655

I get that the output is helpful for debugging, but is there a way to silence it? I would much rather enable it when a test fails to debug, rather than always have it on.

Thanks.

+1  A: 

Try this:

worker = Delayed::Worker.new(:max_priority => nil, 
                             :min_priority => nil,
                             :quiet => true
                            )
worker.work_off

By telling the worker to be quiet it should clean up the spam...

Doon
Thanks. I also forked the project and added a default flag so you can set the default to be quiet in your initializers. Put in a pull request but we'll see if it gets picked up.
ChrisH