Fritz Anderson wrote:
> Periodically my application (a faceless daemon, so there's no
> human-interface considerations) gets the following exception:
> 
> Mysql::Error: MySQL server has gone away: SELECT * FROM `messages` WHERE
> (`messages`.`disposition` IS NULL)  ORDER BY senttime
> (ActiveRecord::StatementInvalid)
> 
> I've concluded this is an inevitable vicissitude of our MySQL server
> setup. I'm now catching the exception. My question is what I should do
> once I catch it.
> 
> I am sleeping for 5 minutes and retrying the find(). Is this enough?
> 
> Or should I re-run ActiveRecord::Base.establish_connection as well?

Is this in response to a normal controller request?

You might like to call Message.verify_active_connections!
before your find.

-- 
Rails Wheels - Find Plugins, List & Sell Plugins - http://railswheels.com

--~--~---------~--~----~------------~-------~--~----~
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 [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to