[Mailman-Developers] Using Mailman as a broadcast list manager - folo
Jay R. Ashworth
jra@baylink.com
Mon, 12 Mar 2001 20:53:56 -0500
Well, everyone's apparently busy doing other stuff just now, so I
hacked around in SMTPdirect.py, and added the following:
==========================
# Split the recipient list into SMTP_MAX_RCPTS chunks. Most MTAs have a
# limit on the number of recipients they'll swallow in a single
# transaction.
if mm_cfg.SMTP_MAX_RCPTS <= 0:
chunks = [recips]
else:
chunks = chunkify(recips, mm_cfg.SMTP_MAX_RCPTS)
refused = {}
t0 = time.time()
# Look in the list for a max/day, set up to pause for the necessary
# amount of time. This will hose the efficiency logging stuff,
# but I don't see any other approach...
# grabbed from globals for now, til I unwind the context
# Mon Mar 12 15:38:48 EST 2001 by jra@baylink.com
msg_limit = 0
try:
msg_limit = mm_cfg.MAX_MSGS_PER_DAY
except:
pass
if msg_limit > 0:
max_chunks_per_day = (msg_limit / mm_cfg.SMTP_MAX_RCPTS)
delay_after_chunk = 86400 / max_chunks_per_day
# We can improve performance by unlocking the list during delivery. We
# must re-lock it though afterwards to ensure the pipeline delivery
# invariant.
try:
mlist.Save()
mlist.Unlock()
if threading:
threaded_deliver(admin, msgtext, chunks, refused)
else:
for chunk in chunks:
deliver(admin, msgtext, chunk, refused)
# throttle deliveries
if msg_limit > 0:
time.sleep(delay_after_chunk)
finally:
t1 = time.time()
mlist.Lock()
# Log the successful post
syslog('smtp', 'smtp for %d recips, completed in %.3f seconds' %
(len(recips), (t1-t0)))
================================
But I'm not sure how that's going to fly.
Without a MAX_MSGS_PER_DAY set in mm_cfg.py, it doesn't seem to be
affecting the bulk subscribe welcome messages...
though I had to hand chunk those into 1000 address groups; add_members
is simply *not* architected to load in 51,000 addresses at a time; the
loops are too deep.
Will this approach cause locking problems, etc?
Cheers,
-- jra
--
Jay R. Ashworth jra@baylink.com
Member of the Technical Staff Baylink
The Suncoast Freenet The Things I Think
Tampa Bay, Florida http://baylink.pitas.com +1 727 804 5015