Rails 2.3.5
I’ve been adding an email system to a ‘tickets’ type application. This morning the email server wend down for a few minutes and I noticed (at least in development mode) Rails will just halt executing and come back with a timeout error.
On the user side, it looks like there was no result to the action they just took (new ticket created, edited, commented on, completed, etc).
1) Is there some method to use continue after an actionmailer error like VB’s ‘on error resume next’ – so that the app just doesn’t stop in process for the user because there was a problem sending a notifier email ?
2) In the controller methods, I’m sending the email and then performing the render/redirects. Is it possible to complete the ticket action taken and get the user to the new/next page before the email is sent? Like the user clicks ‘complete’ and the complete action sets a flash msg and redirects to the index page, AND THEM actionmailer fires?
I would strongly suggest looking into something like DelayedJob, or Resque to hand off from your application to process the emails in the background – that way the end user isn’t waiting for the process to completed and you can then handle retries etc in the background.