Skip to content

Set up an after hook to clear active connections after each request#10

Open
nbudin wants to merge 1 commit into
bmizerany:masterfrom
nbudin:master
Open

Set up an after hook to clear active connections after each request#10
nbudin wants to merge 1 commit into
bmizerany:masterfrom
nbudin:master

Conversation

@nbudin

@nbudin nbudin commented Apr 18, 2012

Copy link
Copy Markdown

Recent versions of ActiveRecord don't automatically release connections back into the pool. Without this patch, the user has to manually set up this hook if they don't want every nth request to hang for 5 seconds (where n is the number of connections in the pool).

@mcfiredrill

Copy link
Copy Markdown

I'm using this too, found out about it via this thread:

https://groups.google.com/forum/#!msg/copenhagen-ruby-user-group/GEHgi_WudmM/gnCiwWqmVfMJ

@janko

janko commented May 22, 2012

Copy link
Copy Markdown

You can download the new version of the gem, I've submitted your commit. I'm the new maintainer now, here's my fork :)

@mcfiredrill

Copy link
Copy Markdown

👍

@nbudin

nbudin commented May 27, 2012

Copy link
Copy Markdown
Author

Great, thanks janko-m! Glad to meet the new maintainer in town, and it looks like you're already doing great work with your fork.

@janko

janko commented May 27, 2012

Copy link
Copy Markdown

My pleasure :)

mediaslave24 referenced this pull request in mediaslave24/sinatra-activerecord Jul 18, 2013
@cefigueiredo

Copy link
Copy Markdown

Some news about that PR? I'm gettin struck by this problem too... sinatra-activerecord are not releasing a connection, and creating some until the pool cap, getting exceptions on every request after!

@janko

janko commented Sep 1, 2014

Copy link
Copy Markdown

Well, the PR is merged, so if you're still having problems, post an issue to janko-m/sinatra-activerecord.

@lksv

lksv commented Aug 25, 2015

Copy link
Copy Markdown

why don't use middleware: use ActiveRecord::ConnectionAdapters::ConnectionManagement?

janko added a commit to sinatra-activerecord/sinatra-activerecord that referenced this pull request Aug 25, 2015
@janko

janko commented Aug 25, 2015

Copy link
Copy Markdown

@lksv Thanks, I didn't know that existed. It's certainly a more robust way, so I updated the gem and released a new version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants