I have a rails app serving up XML on an infrequent basis. This is being
run with mongrel and mysql. I’ve found that if the app does not get
exercised for longer than a few hours it goes dead (“Lost Connection to
MySQL”) and starts throwing Errno::EPIPE errors. It seems that the mysql
connection gets timed out for inactivity or something like that.
It can be restarted with ‘mongrel_rails restart -P
/path/to/the/mongrel.pid’ … but that’s not really a solution. My
collaborator expects the app to be there when he is working on his part
(and I am most likely not around).
My question is:
What can I do to prevent this problem from occurring in the 1st place?
(e.g. don’t time me out!!).
Failing that, is there some code I can insert somewhere to automatically
remake the Db connection?