From 1014fc621ef60301911e7efbd5d48dc44f1cdbb2 Mon Sep 17 00:00:00 2001 From: Himanshu Mishra Date: Mon, 14 Jan 2019 12:54:19 +0530 Subject: [PATCH 1/3] Don't assume async value If async was passed in it was being set as true even if the paased value is false. This commit fixes the same. --- frappe/utils/background_jobs.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frappe/utils/background_jobs.py b/frappe/utils/background_jobs.py index f1194edaf4..46a1546a55 100755 --- a/frappe/utils/background_jobs.py +++ b/frappe/utils/background_jobs.py @@ -37,7 +37,7 @@ def enqueue(method, queue='default', timeout=None, event=None, ''' # To handle older implementations if 'async' in kwargs: - is_async = True + is_async = kwargs.get('async') del kwargs['async'] if now or frappe.flags.in_migrate: From 3587edd484549513f6fd8323a95f18078dab96d0 Mon Sep 17 00:00:00 2001 From: Himanshu Mishra Date: Mon, 14 Jan 2019 13:15:12 +0530 Subject: [PATCH 2/3] Use pop instead of condition --- frappe/utils/background_jobs.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/frappe/utils/background_jobs.py b/frappe/utils/background_jobs.py index 46a1546a55..a65d1d8e03 100755 --- a/frappe/utils/background_jobs.py +++ b/frappe/utils/background_jobs.py @@ -36,10 +36,8 @@ def enqueue(method, queue='default', timeout=None, event=None, :param kwargs: keyword arguments to be passed to the method ''' # To handle older implementations - if 'async' in kwargs: - is_async = kwargs.get('async') - del kwargs['async'] - + is_async = kwargs.pop('async', is_async) + if now or frappe.flags.in_migrate: return frappe.call(method, **kwargs) From 3121a60292cf42d57f2bfeb5c185d39e48b4b4e8 Mon Sep 17 00:00:00 2001 From: Sagar Vora Date: Tue, 29 Jan 2019 11:00:04 +0530 Subject: [PATCH 3/3] fix: remove trailing whitespace. --- frappe/utils/background_jobs.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frappe/utils/background_jobs.py b/frappe/utils/background_jobs.py index a65d1d8e03..99e24bdf44 100755 --- a/frappe/utils/background_jobs.py +++ b/frappe/utils/background_jobs.py @@ -37,7 +37,7 @@ def enqueue(method, queue='default', timeout=None, event=None, ''' # To handle older implementations is_async = kwargs.pop('async', is_async) - + if now or frappe.flags.in_migrate: return frappe.call(method, **kwargs)