Dashing-rails (Rufus-scheduler を使用) を使用して、ブラウザー ウィジェットに更新を送信しています。
ブラウザーからページへの 5 つの個別の要求の後、「ActiveRecord::ConnectionTimeoutError」が原因でサイトがクラッシュします。
私の仮説は、各ブラウザーの equests が rufus-scheduler スレッドの作成をトリガーするというものです。このスレッドは更新を送信し、スレッドは ActiveRecord 接続を解放せずに保持し、最終的にタイムアウトを引き起こします。
ただし、ActiveRecord プールへの接続をリリースするスケジュールを確実にしようとしましたが、役に立ちませんでした。
Dashing.scheduler.every '10s', :allow_overlapping => false do
ActiveRecord::Base.connection_pool.with_connection do
Dashing.send_event('past_hour', { value: Device.sightings_past_hour })
d = Device.where("company != ''").last
company = d.company !="" ? d.company : "Device Manufacturer Not Found"
Dashing.send_event('last_MAC', { text: "#{company}",
moreinfo: "MAC Address: #{d.macaddress}"})
Dashing.send_event('macaddresses', { current: Device.total_Count })
top_manufacturers=Device.manufacturers_dashboard
Dashing.send_event('manufacturers', {items: top_manufacturers})
Dashing.send_event('past_day', { current: Device.sightings_past_day })
end
ActiveRecord::Base.connection_pool.release_connection
end
各スレッドで実行されているプロセス/ActiveRecord 接続を保持しているものを確認する方法はありますか? または、これが問題である場合、Dashing-rails が ActiveRecord 接続を保持しないようにしますか?