warmup(ip-rehab): bias recipients to multi-subscriber business domains (cut bounce)
Day-0 batch saw ~45% bounce because 'no listmonk bounce record' is a weak liveness signal. Now require the recipient's domain to have >=2 enabled subscribers (a real org, not a one-off typo'd address), which materially lowers the dead-mailbox bounce rate on the recovering IPs.
This commit is contained in:
parent
25f4a7503b
commit
1c2e263bb7
1 changed files with 10 additions and 0 deletions
|
|
@ -79,9 +79,19 @@ def pick_recipients(n: int, exclude: set[str]) -> list[tuple[str, str]]:
|
|||
Queried via `docker exec <pg> psql` since the host has no pg driver.
|
||||
"""
|
||||
consumer_list = "(" + ",".join("'%s'" % d for d in CONSUMER) + ")"
|
||||
# Bias toward higher-deliverability recipients on a recovering IP:
|
||||
# - real business/ISP domains (never consumer)
|
||||
# - never recorded a bounce in listmonk
|
||||
# - domain has >= 2 enabled subscribers (a real org, not a one-off typo'd
|
||||
# address) -- this materially cuts the dead-mailbox bounce rate.
|
||||
sql = (
|
||||
"WITH dom AS ("
|
||||
" SELECT lower(split_part(email,'@',2)) AS d, count(*) AS c "
|
||||
" FROM subscribers WHERE status='enabled' GROUP BY 1 HAVING count(*) >= 2"
|
||||
") "
|
||||
"SELECT s.email, COALESCE(s.name,'') "
|
||||
"FROM subscribers s "
|
||||
"JOIN dom ON dom.d = lower(split_part(s.email,'@',2)) "
|
||||
"WHERE s.status='enabled' "
|
||||
f"AND lower(split_part(s.email,'@',2)) NOT IN {consumer_list} "
|
||||
"AND NOT EXISTS (SELECT 1 FROM bounces b WHERE b.subscriber_id=s.id) "
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue