WARN DEPRECATION WARNING: Database connections will not be closed automatically...

WARN  DEPRECATION WARNING: Database connections will not be closed automatically, 
please close your database connection at the end of the thread by calling `close` on your connection.  For example: ActiveRecord::Base.connection.close. (called from mon_synchronize at /home/rochkind/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/monitor.rb:211)

サッカーカレンダー(beta)の話ではないんですが、とある heroku のサイトで、時々サーバーからのレスポンスが遅くひっかかるような事があったので、heroku のログを眺めていたら上記の警告が出る事があった。この警告が出るとserviceの値が5000msと、通常の100倍以上になっていた。

ひっかかる原因はこれかーと警告文で検索すると
use ActiveRecord::ConnectionAdapters::ConnectionManagement
しろとヒットするが、これは最初から書いてあった。

試行錯誤の結果、サーバーを Webrick から thin に変えたところ警告も出なくなり、サクサクになりました。ついでにサッカーカレンダー(beta)のサーバーも Webrick から thin にしました。

Windows では Webrick 以外のサーバーで動かすのが面倒だけど、Debian だと Gemfile に 1行追加するだけですんなり動くので楽チンですね。