If a thread dies or I have to kill a thread that is using an ActiveRecord connection, how do I make sure that the ActiveRecord connection is returned back to the pool? I keep getting errors like
DEPRECATION WARNING: Database connections will not be closed automatically, please close your
database connection at the end of the thread by calling
closeon your
connection. For example: ActiveRecord::Base.connection.close
but how do I make sure this happens on a thread that dies unexpectedly, or one that call Thread.kill on?