[Mailman-Developers] SMTPDirect.py using sleep command

Kory Wheatley wheakory@isu.edu
Thu, 05 Sep 2002 16:12:53 -0600


Using Mailman 2.0.13 on Red Hat 7.2

I've got a Mailman mailing list that contains 14,000 subscribers, on a
Linux box that's
using sendmail has the delivery agent that sends all of the messages to
one mail host, because all 14,000 subscribers have an email
account on our mail server. This Linux box is only used to deliver our
Mailman mailing to our Mail server which is a HPUX 11 server, using
sendmail as the routing agent.

We sent a message to the 14,000 recipient  Mailman mailing list the
other day and
it put the load on our Unix Box that contains our mail server to the
roof

What I have done to maybe slow down the delivery  to sendmail  that
creates the queue files then delivers them to our mail server is  in the
Mailman SMTPDirect.py I have used the sleep command to sleep after
delivering  so that our mail server can catch up before the next batch
is delivered, this way its not being bombarded.

Now here is where I would appreciate help, I'm not a experienced Python
programmer and maybe what I did below is  stupid and will not work
(using the time.sleep(25) command), but please look at the code and if
it will not work  please let me know what I can code that will work that
will slow down the delivery to our mail server.

------------CODE--------------------

def deliver(envsender, msgtext, recips, failures):
    refused = {}
    # Gather statistics on how long each SMTP dialog takes.
##    t0 = time.time()
    try:
        conn = smtplib.SMTP(mm_cfg.SMTPHOST, mm_cfg.SMTPPORT)
        try:
            # make sure the connect happens, which won't be done by the
            # constructor if SMTPHOST is false
            time.sleep(25)
            refused = conn.sendmail(envsender, recips, msgtext)
        finally:
##            t1 = time.time()
##            syslog('smtp', 'smtp for %d recips, completed in %.3f
seconds' %
##                   (len(recips), (t1-t0)))
            conn.quit()
    except smtplib.SMTPRecipientsRefused, e:
        refused = e.recipients
    # MTA not responding, or other socket problems, or any other kind of

    # SMTPException.  In that case, nothing got delivered
    except (socket.error, smtplib.SMTPException), e:

------------END-----------------