Question: Replacing ActiveRecord::ConnectionAdapters::ConnectionManagement in ActiveRecord 5


Replacing ActiveRecord::ConnectionAdapters::ConnectionManagement in ActiveRecord 5

Answers 0
Added at 2016-12-30 18:12

We are upgrading a Sinatra application from ActiveRecord 4 to ActiveRecord 5. Previously we had this line:

use ActiveRecord::ConnectionAdapters::ConnectionManagement

This is because connections were not being cleaned up after requests completed. Here is prior SO discussion on this topic:

Starting with ActiveRecord 5, this line no longer works. This conversation in the rails project states:

This was removed in favor of Executor and Reloader APIs. That middleware that was removed were not part of the public API. If you want to use that outside Rails you need to make one.

Does this mean that, if someone is to use ActiveRecord 5 with Sinatra, connections will be again 'leaked' or left un-returned to the pool after a request, unless the developer re-creates the now-removed middleware?

In the Sinatra example, is it therefore now the case that we need to include this line in ActiveRecord 5?

after do

That is the implication on the linked-to thread, but I want to get a definite answer I can take back to my dev team.

Source Show
◀ Wstecz