Ask A Question

Notifications

You’re not receiving notifications from this thread.

How to quiet Delayed Job logs in development?

Daniel Weaver asked in Rails

Rails 3.2.14 / Ruby 2.0.0 / Delayed Job 4.1.4 / Foreman

I'm running a worker with Delayed Job, starting the process with Foreman. It all works fine but my dev logs are full of Delayed Job SQL statements. It makes debugging anything in development tiresome. Every 5 seconds I get a big chunk like this:

17:40:26 worker.1 | Delayed::Backend::ActiveRecord::Job Load (0.9ms) UPDATE "delayed_jobs" SET locked_at = '2020-03-25 00:40:26.874025', locked_by = 'host:MacBook-Pro-8.local pid:67410' WHERE id IN (SELECT id FROM "delayed_jobs" WHERE ((run_at <= '2020-03-25 00:40:26.873540' AND (locked_at IS NULL OR locked_at < '2020-03-24 20:40:26.873551') OR locked_by = 'host:MacBook-Pro-8.local pid:67410') AND failed_at IS NULL) ORDER BY priority ASC, run_at ASC LIMIT 1 FOR UPDATE) RETURNING *

How do quiet these SQL logs from Delayed Job? I tried a few solutions form the interwebs but nothing worked so far 😕

Mostly from this thread: https://github.com/collectiveidea/delayed_job/issues/886

Reply

For now I've changed the timer from default 5 seconds to 60 seconds with this:

# config/initializers/delayed_job_config.rb
Delayed::Worker.sleep_delay = 60

Reply
Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 86,796+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.