fix: improve email queue reliability (#23070)
* feat: control email queue batch size with config * fix: Give emails who failed once less priority while sending
This commit is contained in:
parent
ff14c52059
commit
be2beeed9e
1 changed files with 5 additions and 3 deletions
|
|
@ -151,8 +151,10 @@ def flush(from_test=False):
|
|||
|
||||
|
||||
def get_queue():
|
||||
batch_size = cint(frappe.conf.email_queue_batch_size) or 500
|
||||
|
||||
return frappe.db.sql(
|
||||
"""select
|
||||
f"""select
|
||||
name, sender
|
||||
from
|
||||
`tabEmail Queue`
|
||||
|
|
@ -160,8 +162,8 @@ def get_queue():
|
|||
(status='Not Sent' or status='Partially Sent') and
|
||||
(send_after is null or send_after < %(now)s)
|
||||
order
|
||||
by priority desc, creation asc
|
||||
limit 500""",
|
||||
by priority desc, retry asc, creation asc
|
||||
limit {batch_size}""",
|
||||
{"now": now_datetime()},
|
||||
as_dict=True,
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue