Comments (6)
@morgoth whoops, you're correct about ActiveRecord::Base.verbose_query_logs = false
. I was thinking that controlled the entirety of the SQL query logging, but it seems like the query logging is simply a :debug
-level log.
Thinking more about it, it does straddle the line of Rails configuration and GoodJob. Query logging is an implicit feature of Rails and the Rails logger... and GoodJob is unexpectedly verbose just given that it has to poll on a regular basis.
Your workaround is similar to what I have in my Rails projects:
# config/environments/{development.rb|production.rb}
config.log_level = ENV.fetch("RAILS_LOGGER_LEVEL", "info")
I'll transform this Issue into a feature request for a constant for checking whether configuration is running as part of GoodJob.
# config/initializers/good_job.rb
if GoodJob.within_cli?
Rails.application.config.log_level = ENV.fetch("RAILS_LOGGER_LEVEL", "info")
end
from good_job.
I think you’re experiencing Rails’s verbose query logging: https://guides.rubyonrails.org/debugging_rails_applications.html#verbose-query-logs
Verbose query logs are turned on by default in development, and (I think) off in production.
I agree, it’s annoying; it also shows up when running in async
execution mode too.
There are a couple different approaches one could take:
-
Change the log level so DEBUG-level logs are outputted, as you described.
-
Changing
ActiveRecord::Base.verbose_query_logs = false
. -
Making it easier to do either one of those options in configuration when using the
$ good_job
CLI. e,.g.# config/initializers/good_job.rb if GoodJob.within_cli? # not a method that currently exists ActiveRecord::Base.verbose_query_logs = false end
-
You can also dial back the
poll-interval
to something like 1 minute, which would decrease the frequency of the logs.
from good_job.
As it goes for ActiveRecord::Base.verbose_query_logs = false
, it won't tweak this as this config prints the caller of given SQL statement https://github.com/rails/rails/blob/ab4ab090667e96c0e8a2623e33573ae06be14b54/guides/source/debugging_rails_applications.md#verbose-query-logs
I guess having something like GoodJob.within_cli?
would be helpful
from good_job.
As mentioned above you can also raise the polling duration to keep the dev log from getting huge: e.g. 1 minute.
GOOD_JOB_POLL_INTERVAL=60 bundle exec good_job start
@bensheldon states that polling can be shut off by setting the interval to -1
but I could not get that to stick, tried:
GOOD_JOB_POLL_INTERVAL=-1
GOOD_JOB_POLL_INTERVAL="-1"
from good_job.
@minimul Thanks for the assist and for flagging that problem! I've opened up an Issue #133 to investigate.
from good_job.
Revisiting this, there is a method to test whether the current process is running as part of the $ good_job
executable:
GoodJob::CLI.within_exe?
from good_job.
Related Issues (20)
- Idea / feature request - deferring execution of batch jobs while still writing them to the database HOT 3
- ActiveSupport::CurrentAttributes reset after `perform_later` HOT 3
- Potential documentation error in GoodJob::ActiveJobExtensions::NotifyOptions HOT 2
- Proposal: Migrating Documentation to a Separate Website HOT 1
- `erb_lint` doesn't lint all files HOT 1
- Executing perform_now on a good_job with GoodJobs::ActiveJobExtensions::Concurrency can run twice HOT 7
- How do I add jobs to an existing batch? HOT 7
- ActiveSupport::CurrentAttributes Compatibility HOT 5
- [Feature request] OpenTelemetry - Link job execution to the request which queued it HOT 2
- How to properly handle interrupts HOT 5
- Document how cron with proc works
- [Feature Request] Nested batches: Allow a parent batch to wait on the completion of child batches
- Unable to use labels with kwargs in job initializer HOT 2
- Whitespace in `queues` configuration can cause issues. HOT 2
- throttling not working as one would expect? HOT 2
- `#good_job_labels` retains values across job instances HOT 3
- Undefined `GoodJob::Process.advisory_lockable_column` HOT 3
- Warn on unapplied migrations HOT 2
- NoMethodError: undefined method `<' for nil (process.rb:125 in stale?) HOT 1
- Change how svg images are inserted into partials
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from good_job.