jaime.silvela-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-Jan-17 14:09 UTC
resilience to database restart
Hi, apologies if you''ve discussed this already, but I haven''t seen it: I''m using rails in a multiserver environment. There is one central server which is used to run Postgres and Rails. Then there are several satellite servers that are supposed to pick up tasks from the Postgres database and execute them. The servers use ActiveRecord to connect to the database, even though they don''t run Rails. It''s a rudimentary distributed computed facility. Each satellite server runs a daemon that checks the central DB for new tasks, and if it finds one, spawns a new thread to execute that task. Here''s the problem: the central Postgres server is rebooted weekly. When this happens, the satellite servers crash when they try to find new tasks, and take down the threads they had spawned and were still active. My idea was to catch all exceptions in the daemon processes, and periodically try to reconnect, however it seems overkill to wrap every statement in a begin-rescue block. I was wondering if someone has a more elegant solution to suggest. Also I''ve read about *ActiveRecord::Base.verification_timeout *and was hopeful, but I don''t think it''s suited for this case. Any suggestions will be appreciated. Thanks Jaime --~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---