Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
[Rails] Connection Pool Timeout #48
I was having an issue where I was trying to perform too many long running DB connections in parallel. Rails suggested I increase my connection pool size, but I was afraid of having too many connections to mySQL per web worker process.
I realized my error was that I was simply using too many of the available connections, so I wanted to make sure I never exceeded the available pool. My solution was to use something like
This will use the number of connections equal to the number of records, OR the connection pool size, whichever is smaller.