Inappropriately accesses the database during initialization #81
Comments
I have this problem as well, and it's a pain. Have to pull vanity out, precompile, then put it back in again :( |
Have a workaround of sorts. see commit https://github.com/tkharris/vanity/commit/03eb846e8fc09b4a3d27f7e26b282e13ae76f1fd in tkharris/vanity where we conditionally init based on an environment variable, then I set that variable in the assets:precompile with a file in lib/tasks: namespace :assets do
Rake::Task[:precompile].enhance [:novanity]
desc "Don't load vanity during assets:precompile"
task :novanity do
ENV['NOVANITY'] = '1'
end
end This is not a fix really, vanity shouldn't depend on a db connection to |
It's interesting that New Relic apparently has the exact same problem, and and very similar solution to their problem was proposed, using |
This worked for me: |
Not from my end. As you said, this is quite old. :) |
I think I'm going to close this issue. As @eugenijusr points out, |
I believe you've misunderstood the problem. When you precompile assets, you run it in the |
@stouset thanks for following up. I think you're right, I'll reopen. |
@tkharris thanks for pointing out the new relic example, some links from their repo:
|
Sorry, I just want to clarify some thoughts:
|
* Refactor Playground#initialize to use #autoconnect. * Closes #81.
* Refactor Playground#initialize to use #autoconnect. * Closes #81.
A E.g.: production:
collecting: false Alternatively, the mock adapter will allow Vanity to be used with in-memory persistence, so the mock adapter could be used if production:
adapter: mock |
In Rails 3, when running
rake assets:precompile
, Vanity tries to access the production Redis database. It also tries to access the SQL database ifmodel
is specified in a a metric. Unfortunately, in an app that runs on Heroku, the production database is never specified and/or accessible from the local console.I'm not sure exactly why it would be accessing the databases when even ActiveRecord doesn't, but it needs to somehow access the information lazily rather than actively.
The text was updated successfully, but these errors were encountered: