New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ActiveRecord::ConnectionTimeoutError on rails model callbacks #626
Comments
Please provide enough information for this bug report. |
My model Photo, has an attached file used with paperclip. EM.run do
non_blocking = proc do
.. some codes here
end
EM.defer non_blocking
end But if I uploaded many photos and this callback was being called many times, it throws this error |
Some related discussion: https://www.ruby-forum.com/topic/195010 |
I am using postgresql. |
I solved it by making sure the connection pool has been released. EM.run do
non_blocking = proc do
begin
.. some codes here
ensure
ActiveRecord::Base.connection_pool.release_connection
end
end
EM.defer non_blocking
end |
Good to hear! Do you think there's some documentation improvements you could suggest to help this situation? |
Yes, much better if you provide more examples in different scenarios. |
I am using EM.def in some of my rails Model callbacks and sometimes it throws error
ActiveRecord::ConnectionTimeoutError (could not obtain a database connection within 5.000 seconds (waited 5.000 seconds))
The text was updated successfully, but these errors were encountered: