Skip to content

Generalize silence_polling to silence_queries#732

Open
diogovernier wants to merge 2 commits intorails:mainfrom
diogovernier:generalize-silence-polling-to-silence-queries
Open

Generalize silence_polling to silence_queries#732
diogovernier wants to merge 2 commits intorails:mainfrom
diogovernier:generalize-silence-polling-to-silence-queries

Conversation

@diogovernier
Copy link
Copy Markdown

Closes #210. Supersedes #389.

Summary

Implements the silence_queries approach approved by @rosa in #198: a single unified config that silences all of Solid Queue's internal SQL logging, including polling, heartbeats, concurrency maintenance, process pruning, and scheduler dynamic task reloading.

silence_polling is preserved as a backward-compatible alias, as suggested by @namolnad in #210.

Motivation

silence_polling only covers worker and dispatcher polling queries. In practice, heartbeat UPDATEs (every 60s per process), semaphore expiration, blocked execution unblocking, and dead process pruning are equally noisy, especially in development or when running with RAILS_LOG_LEVEL=debug.

Multiple users have reported this (#210, #389 comments, workarounds via custom log-level overrides and monkeypatches), and @rosa indicated in #389 that she'd prefer a single unified toggle over accumulating per-feature silencing flags:

"I was hoping we could get #210 done instead of having a bunch of different options to silence different parts."

Approach

  • Extracts a shared with_silenced_queries helper in AppExecutor (which is already included by every class that touches the DB)
  • Poller#with_polling_volume now delegates to the shared helper instead of inlining the silencing logic
  • All periodic internal operations are wrapped: heartbeats, concurrency maintenance, process pruning, scheduler dynamic task reloading, and metadata reload
  • One-time boot queries (e.g., schedule_tasks, fail_orphaned_executions) are deliberately not silenced. They can be useful for debugging deployment issues and only run once

What changed

File Change
lib/solid_queue.rb mattr_accessor :silence_queries replaces :silence_polling; backward-compat alias methods added
lib/solid_queue/app_executor.rb New with_silenced_queries helper (shared by all call sites)
lib/solid_queue/processes/poller.rb with_polling_volume now delegates to with_silenced_queries
lib/solid_queue/processes/registrable.rb Heartbeat timer and reload_metadata wrapped
lib/solid_queue/dispatcher/concurrency_maintenance.rb expire_semaphores and unblock_blocked_executions wrapped
lib/solid_queue/supervisor/maintenance.rb prune_dead_processes wrapped
lib/solid_queue/scheduler/recurring_schedule.rb reschedule_dynamic_tasks wrapped
README.md Docs updated to reference silence_queries; mentions silence_polling alias
test/unit/worker_test.rb Existing polling tests updated + new heartbeat silencing tests + backward-compat test
test/unit/dispatcher_test.rb Existing polling tests updated to use new config name

Backward compatibility

Existing config.solid_queue.silence_polling = true/false continues to work. The engine initializer calls SolidQueue.public_send("silence_polling=", value), which hits our custom setter and delegates to silence_queries=. Getter and predicate methods also delegate. No breaking changes.

Replace `silence_polling` with a unified `silence_queries` config that
silences all of Solid Queue's internal SQL logging: polling, heartbeats,
concurrency maintenance, process pruning, and scheduler dynamic task
reloading.

This implements the approach approved by @rosa in rails#198 and addresses the
long standing request in rails#210: a single toggle instead of accumulating
per feature silencing flags (rails#389).

`silence_polling` remains as a backward compatible alias.
MySQL fully qualifies column names in UPDATE statements as
`table`.`column`, so the regex needs .+ instead of . between
SET and last_heartbeat_at.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Generalize silence_polling to silence_queries

1 participant