fix: task should explicitly call commit and rollback if error

This commit is contained in:
tundebabzy 2018-03-01 17:06:39 +01:00
parent 36c18c913e
commit ca5cf35a99

View File

@ -424,8 +424,15 @@ def process(data):
Checks a `Subscription` and updates it status as necessary
"""
if data:
subscription = frappe.get_doc('Subscriptions', data['name'])
subscription.process()
try:
subscription = frappe.get_doc('Subscriptions', data['name'])
subscription.process()
frappe.db.commit()
except frappe.ValidationError:
frappe.db.rollback()
frappe.db.begin()
frappe.log_error(frappe.get_traceback())
frappe.db.commit()
@frappe.whitelist()