I’m running rails behind a firewall which times out idle tcp
connections. What would be the best way to have rails ping the
database every so many minutes? Or alternatively, is it possible to
ping it myself before the session (which uses a database) is created?
Chris
On 9/12/06, snacktime [email protected] wrote:
I’m running rails behind a firewall which times out idle tcp
connections. What would be the best way to have rails ping the
database every so many minutes? Or alternatively, is it possible to
ping it myself before the session (which uses a database) is created?
Chris
Well it appears that I could use
ActiveRecord::Base.connection.verify!, now the question is how to
verify before the session is accessed.
On 9/12/06, snacktime [email protected] wrote:
I’m running rails behind a firewall which times out idle tcp
connections. What would be the best way to have rails ping the
database every so many minutes? Or alternatively, is it possible to
ping it myself before the session (which uses a database) is created?
The simplest way is to set up a cron job somewhere to curl http://myapp.
You could also experiment with something like
Thread.new do
loop { ActiveRecord::Base.verify_active_connections!; sleep 300 }
end
jeremy
On 9/12/06, Jeremy K. [email protected] wrote:
On 9/12/06, snacktime [email protected] wrote:
I’m running rails behind a firewall which times out idle tcp
connections. What would be the best way to have rails ping the
database every so many minutes? Or alternatively, is it possible to
ping it myself before the session (which uses a database) is created?
The simplest way is to set up a cron job somewhere to curl http://myapp.
I think you are right, the simplest is probably the best.