We were doing some optimizations and noticed that the QueryCache is not being used in our worker process (resulting in some repeated DB calls).
class TestJob < ActiveJob::Base
It looks like QueryCache is only enabled on each request via the ActiveSupport::Executor. Would it make sense to enable/disable the QueryCache around every job perform? Or wrap calls with the AS::Executor? Also I’d love to hear if there are other places where this would make sense (I’m thinking runner/rake task/console).
Tangentially, this is my first post on this list: many thanks to the Rails team for their continued work, support and leadership over the many many years! I hope you know that through Rails and your dedication to open source you have enabled the company that I work for to bring software solutions to non-profits that otherwise would not have had the possibility to.
That’s strange, the query cache is definitely enabled in Active Job in our app. We have tests making sure it is at GitHub. Could there be another gem or code in your application causing the query cache to be turned off for you?
Thank you @eileencodes and @matthewd for your help! I confirmed with a clean setup that the QueryCache works in production with ActiveJob. I’ll have to investigate further to see what’s happening in our setup/in the development environment, and hopefully bring a productive contribution (to the docs ).