{"action":"created","issue":{"url":"https://api.github.com/repos/rails/rails/issues/23073","labels_url":"https://api.github.com/repos/rails/rails/issues/23073/labels{/name}","comments_url":"https://api.github.com/repos/rails/rails/issues/23073/comments","events_url":"https://api.github.com/repos/rails/rails/issues/23073/events","html_url":"https://github.com/rails/rails/issues/23073","id":126941076,"number":23073,"title":"Setting connection pool size to zero behaves as a pool of size one","user":{"login":"johnkolen","id":653313,"avatar_url":"https://avatars.githubusercontent.com/u/653313?v=3","gravatar_id":"","url":"https://api.github.com/users/johnkolen","html_url":"https://github.com/johnkolen","followers_url":"https://api.github.com/users/johnkolen/followers","following_url":"https://api.github.com/users/johnkolen/following{/other_user}","gists_url":"https://api.github.com/users/johnkolen/gists{/gist_id}","starred_url":"https://api.github.com/users/johnkolen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/johnkolen/subscriptions","organizations_url":"https://api.github.com/users/johnkolen/orgs","repos_url":"https://api.github.com/users/johnkolen/repos","events_url":"https://api.github.com/users/johnkolen/events{/privacy}","received_events_url":"https://api.github.com/users/johnkolen/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-01-15T19:32:41Z","updated_at":"2016-01-15T20:53:32Z","closed_at":null,"body":"Setting a pool size of zero should force a new connection for each request. When a connection is checked back in, it is always added to the queue of available connections. The first action of acquire_connection is to pull from the available queue. Even when size is zero, the second pool checkout will return the connection returned after the first checkout.\r\n\r\nOne possible solution is to maintain the size invariant on @available in addition to @connections during check in. \r\n\r\nWe have an external DB where we need to close connections after use, so we really don't want to reuse connections."},"comment":{"url":"https://api.github.com/repos/rails/rails/issues/comments/172089830","html_url":"https://github.com/rails/rails/issues/23073#issuecomment-172089830","issue_url":"https://api.github.com/repos/rails/rails/issues/23073","id":172089830,"user":{"login":"yahonda","id":73684,"avatar_url":"https://avatars.githubusercontent.com/u/73684?v=3","gravatar_id":"","url":"https://api.github.com/users/yahonda","html_url":"https://github.com/yahonda","followers_url":"https://api.github.com/users/yahonda/followers","following_url":"https://api.github.com/users/yahonda/following{/other_user}","gists_url":"https://api.github.com/users/yahonda/gists{/gist_id}","starred_url":"https://api.github.com/users/yahonda/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yahonda/subscriptions","organizations_url":"https://api.github.com/users/yahonda/orgs","repos_url":"https://api.github.com/users/yahonda/repos","events_url":"https://api.github.com/users/yahonda/events{/privacy}","received_events_url":"https://api.github.com/users/yahonda/received_events","type":"User","site_admin":false},"created_at":"2016-01-15T20:53:32Z","updated_at":"2016-01-15T20:53:32Z","body":"I also think this is kind of a feature request to Rails. I recall there is a gem which may satisfy your requirement. https://github.com/sonots/activerecord-refresh_connection"}}