From 980443de225c3ed232605256bfed48e2f13f8c6c Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Thu, 26 May 2016 12:31:34 +0530 Subject: [PATCH] [fix] bulk flush - ignore error if job timed out, and retry next time --- frappe/email/bulk.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/frappe/email/bulk.py b/frappe/email/bulk.py index 676dfb1fc5..eaf1cb062a 100644 --- a/frappe/email/bulk.py +++ b/frappe/email/bulk.py @@ -11,6 +11,7 @@ from frappe.email.email_body import get_email, get_formatted_html from frappe.utils.verified_command import get_signed_params, verify_request from html2text import html2text from frappe.utils import get_url, nowdate, encode, now_datetime, add_days, split_emails, cstr +from rq.timeouts import JobTimeoutException class BulkLimitCrossedError(frappe.ValidationError): pass @@ -305,9 +306,10 @@ def send_one(email, smtpserver=None, auto_commit=True, now=False): except (smtplib.SMTPServerDisconnected, smtplib.SMTPConnectError, smtplib.SMTPHeloError, - smtplib.SMTPAuthenticationError): + smtplib.SMTPAuthenticationError, + JobTimeoutException): - # bad connection, retry later + # bad connection/timeout, retry later frappe.db.sql("""update `tabBulk Email` set status='Not Sent', modified=%s where name=%s""", (now_datetime(), email.name), auto_commit=auto_commit)