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 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
On 9/12/06, snacktime <snacktime-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
On 9/12/06, snacktime <snacktime-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
On 9/12/06, Jeremy Kemper <jeremy-w7CzD/W5Ocjk1uMJSBkQmQ@public.gmane.org> wrote:> On 9/12/06, snacktime <snacktime-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---