diff options
| author | cotton | 1998-10-05 15:03:10 +0000 |
|---|---|---|
| committer | cotton | 1998-10-05 15:03:10 +0000 |
| commit | 904dc1c08e077cc251e6b50846bf3f3d412bfa7f (patch) | |
| tree | 7619bcb2a065a85088e2dc027d3f08283273aae9 /Mailman/Utils.py | |
| parent | 97d7c904a4b559a0c92d132ac6ff37a57c9aaf1f (diff) | |
| download | mailman-904dc1c08e077cc251e6b50846bf3f3d412bfa7f.tar.gz mailman-904dc1c08e077cc251e6b50846bf3f3d412bfa7f.tar.zst mailman-904dc1c08e077cc251e6b50846bf3f3d412bfa7f.zip | |
changed contact_transport so that it doesn't invoke a queue run
ditto for Utils.SendTextToUser.
rearranged OutgoingQueue so that
1) it sets a global lock to only allow on queue run at a time
2) enqueueMessage puts a queue entry in an active state
2) the queue run only processes messages in a deferred state
or messages that are in an active state but stale
3) it has a deferMessage interface. which is now used by Utils.TrySMTPDelivery
It now keeps track of the state of a q entry by means of file metadata - if the
qfile is setuid, it's in active state, if it's not it's in deferred state.
scott
Diffstat (limited to 'Mailman/Utils.py')
| -rw-r--r-- | Mailman/Utils.py | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/Mailman/Utils.py b/Mailman/Utils.py index 44127df18..cd4e6d961 100644 --- a/Mailman/Utils.py +++ b/Mailman/Utils.py @@ -171,7 +171,6 @@ def DeliverToUser(msg, recipient, add_headers=[]): if os.fork(): return sender = msg.GetSender() - try: try: msg.headers.remove('\n') @@ -188,8 +187,6 @@ def DeliverToUser(msg, recipient, add_headers=[]): import OutgoingQueue queue_id = OutgoingQueue.enqueueMessage(sender, recipient, text) TrySMTPDelivery(recipient,sender,text,queue_id) - # Just in case there's still something waiting to be sent... - OutgoingQueue.processQueue() finally: os._exit(0) @@ -203,26 +200,28 @@ def TrySMTPDelivery(recipient, sender, text, queue_entry): con.helo(mm_cfg.DEFAULT_HOST_NAME) con.send(to=recipient,frm=sender,text=text) con.quit() - dequeue = 1 + defer = 0 failure = None + # # Any exceptions that warrant leaving the message on the queue should - # be identified by their exception, below, with setting 'dequeue' to 1 + # be identified by their exception, below, with setting 'defer' to 1 # and 'failure' to something suitable. Without a particular exception # we fall through to the blanket 'except:', which dequeues the message. - + # except socket.error: # MTA not responding, or other socket prob - leave on queue. - dequeue = 0 + defer = 1 failure = sys.exc_info() - except: # Unanticipated cause of delivery failure - *don't* leave message # queued, or it may stay, with reattempted delivery, forever... - dequeue = 1 + defer = 0 failure = sys.exc_info() - if dequeue: + if defer: + OutgoingQueue.deferMessage(queue_entry) + else: OutgoingQueue.dequeueMessage(queue_entry) if failure: # XXX Here may be the place to get the failure info back to the @@ -232,7 +231,8 @@ def TrySMTPDelivery(recipient, sender, text, queue_entry): l.write("To %s:\n" % recipient) l.write("\t %s / %s\n" % (failure[0], failure[1])) l.flush() - + + def QuotePeriods(text): return string.join(string.split(text, '\n.\n'), '\n .\n') @@ -457,3 +457,9 @@ def maketext(templatefile, dict, raw=0): if raw: return template % dict return wrap(template % dict) + + + + + + |
