Generalize silence_polling to silence_queries#732
Open
diogovernier wants to merge 2 commits intorails:mainfrom
Open
Generalize silence_polling to silence_queries#732diogovernier wants to merge 2 commits intorails:mainfrom
diogovernier wants to merge 2 commits intorails:mainfrom
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #210. Supersedes #389.
Summary
Implements the
silence_queriesapproach 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_pollingis preserved as a backward-compatible alias, as suggested by @namolnad in #210.Motivation
silence_pollingonly covers worker and dispatcher polling queries. In practice, heartbeatUPDATEs (every 60s per process), semaphore expiration, blocked execution unblocking, and dead process pruning are equally noisy, especially in development or when running withRAILS_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:
Approach
with_silenced_querieshelper inAppExecutor(which is already included by every class that touches the DB)Poller#with_polling_volumenow delegates to the shared helper instead of inlining the silencing logicschedule_tasks,fail_orphaned_executions) are deliberately not silenced. They can be useful for debugging deployment issues and only run onceWhat changed
lib/solid_queue.rbmattr_accessor :silence_queriesreplaces:silence_polling; backward-compat alias methods addedlib/solid_queue/app_executor.rbwith_silenced_querieshelper (shared by all call sites)lib/solid_queue/processes/poller.rbwith_polling_volumenow delegates towith_silenced_querieslib/solid_queue/processes/registrable.rbreload_metadatawrappedlib/solid_queue/dispatcher/concurrency_maintenance.rbexpire_semaphoresandunblock_blocked_executionswrappedlib/solid_queue/supervisor/maintenance.rbprune_dead_processeswrappedlib/solid_queue/scheduler/recurring_schedule.rbreschedule_dynamic_taskswrappedREADME.mdsilence_queries; mentionssilence_pollingaliastest/unit/worker_test.rbtest/unit/dispatcher_test.rbBackward compatibility
Existing
config.solid_queue.silence_polling = true/falsecontinues to work. The engine initializer callsSolidQueue.public_send("silence_polling=", value), which hits our custom setter and delegates tosilence_queries=. Getter and predicate methods also delegate. No breaking changes.