[FIX] mail: avoid catching (transient) MemoryErrors when sending outgoing mail

This would permanently mark the mail as failed while
there is a good chance it will be sent properly next
time it is retried (provided the memory situation
improves or the server/worker has restarted).

bzr revid: odo@openerp.com-20140430102552-qkwv20b20nve64th
This commit is contained in:
Olivier Dony 2014-04-30 12:25:52 +02:00
parent 2d32d9e89c
commit c43fdfe32b
1 changed files with 4 additions and 0 deletions

View File

@ -319,6 +319,10 @@ class mail_mail(osv.Model):
# see revid:odo@openerp.com-20120622152536-42b2s28lvdv3odyr in 6.1
if mail_sent:
self._postprocess_sent_message(cr, uid, mail, context=context)
except MemoryError:
# prevent catching transient MemoryErrors, bubble up to notify user or abort cron job
# instead of marking the mail as failed
raise
except Exception:
_logger.exception('failed sending mail.mail %s', mail.id)
mail.write({'state': 'exception'})