There’s a backport gem for this as well named activerecord_connection_reaper that supports older versions of Ruby/Rails.