From 58fd830b9253f5f7288012d53df796c3b6913d9a Mon Sep 17 00:00:00 2001 From: Makarand Bauskar Date: Wed, 4 Oct 2017 18:17:05 +0530 Subject: [PATCH 1/2] [revert] pull emails from all incoming email accounts instead of enqueuing single email account (#4247) --- .../doctype/email_account/email_account.py | 39 +++++++------------ 1 file changed, 15 insertions(+), 24 deletions(-) diff --git a/frappe/email/doctype/email_account/email_account.py b/frappe/email/doctype/email_account/email_account.py index a36d461c60..307e2e46ff 100755 --- a/frappe/email/doctype/email_account/email_account.py +++ b/frappe/email/doctype/email_account/email_account.py @@ -685,36 +685,27 @@ def pull(now=False): frappe.cache().set_value("workers:no-internet", False) else: return - queued_jobs = get_jobs(site=frappe.local.site, key='job_name')[frappe.local.site] - email_accounts = frappe.db.sql_list("""select name from `tabEmail Account` where - enable_incoming=1 and awaiting_password=0""") - - # No incoming email account available - if not email_accounts: - return + for email_account in frappe.get_list("Email Account", + filters={"enable_incoming": 1, "awaiting_password": 0}): + if now: + pull_from_email_account(email_account.name) - if now: - pull_from_email_accounts(email_accounts) - else: - # job_name is used to prevent duplicates in queue - job_name = 'pull_from_email_accounts|{0}'.format(",".join(email_accounts)) + else: + # job_name is used to prevent duplicates in queue + job_name = 'pull_from_email_account|{0}'.format(email_account.name) - if job_name not in queued_jobs: - enqueue(pull_from_email_accounts, 'short', event='all', job_name=job_name, - email_accounts=email_accounts) + if job_name not in queued_jobs: + enqueue(pull_from_email_account, 'short', event='all', job_name=job_name, + email_account=email_account.name) -def pull_from_email_accounts(email_accounts): +def pull_from_email_account(email_account): '''Runs within a worker process''' - if not email_accounts: - return - - for email_account in email_accounts: - email_account = frappe.get_doc("Email Account", email_account) - email_account.receive() + email_account = frappe.get_doc("Email Account", email_account) + email_account.receive() - # mark Email Flag Queue mail as read - email_account.mark_emails_as_read_unread() + # mark Email Flag Queue mail as read + email_account.mark_emails_as_read_unread() def get_max_email_uid(email_account): # get maximum uid of emails From fafab5620fa535392de92f43aea20a8b7db55507 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 4 Oct 2017 18:48:05 +0600 Subject: [PATCH 2/2] bumped to version 9.0.10 --- frappe/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frappe/__init__.py b/frappe/__init__.py index e18619f247..c1f1a4567d 100644 --- a/frappe/__init__.py +++ b/frappe/__init__.py @@ -14,7 +14,7 @@ import os, sys, importlib, inspect, json from .exceptions import * from .utils.jinja import get_jenv, get_template, render_template, get_email_from_template -__version__ = '9.0.9' +__version__ = '9.0.10' __title__ = "Frappe Framework" local = Local()