diff options
| author | bwarsaw | 2002-01-29 19:12:45 +0000 |
|---|---|---|
| committer | bwarsaw | 2002-01-29 19:12:45 +0000 |
| commit | f0c6ad8caa50b944edac5f26eec05b5b7da3ea91 (patch) | |
| tree | 8c1dda9dbbb7fc6c37ac7eabb9478488b020b077 /cron | |
| parent | 4d88fbed1473c8c51c8086d4636e7b46b0edda1b (diff) | |
| download | mailman-f0c6ad8caa50b944edac5f26eec05b5b7da3ea91.tar.gz mailman-f0c6ad8caa50b944edac5f26eec05b5b7da3ea91.tar.zst mailman-f0c6ad8caa50b944edac5f26eec05b5b7da3ea91.zip | |
main(): Add a sweep & cull step before sending disabled notifications.
Here, we're looking for members who are not yet disabled, but who have
a bounce score >= the threshold. This can happen if the list owner
lowers the threshold. There's no sense in waiting until another
bounce is received on the member before we disable them.
Diffstat (limited to 'cron')
| -rw-r--r-- | cron/disabled | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/cron/disabled b/cron/disabled index 3ad869bfe..2a4e42c36 100644 --- a/cron/disabled +++ b/cron/disabled @@ -46,6 +46,8 @@ from Mailman import mm_cfg from Mailman import Utils from Mailman import MailList from Mailman import MemberAdaptor +from Mailman.Logging.Syslog import syslog +from Mailman.i18n import _ # Work around known problems with some RedHat cron daemons import signal @@ -82,19 +84,44 @@ def main(): if not listnames: listnames = Utils.list_names() + msg = _('[disabled by periodic sweep and cull, no message available]') today = time.mktime(time.localtime()[:3] + (0,) * 6) for listname in listnames: # List of members to notify notify = [] mlist = MailList.MailList(listname, lock=0) interval = mlist.bounce_you_are_disabled_warnings_interval + # Find all the members who are currently bouncing and see if they've + # reached the disable threshold but haven't yet been disabled. This + # is a sweep through the membership catching situations where they've + # bounced a bunch, then the list admin lowered the threshold, but we + # haven't (yet) seen more bounces from the member. Note: we won't + # worry about stale information or anything else since the normal + # bounce processing code will handle that. + disables = [] + for member in mlist.getBouncingMembers(): + if mlist.getDeliveryStatus(member) <> MemberAdaptor.ENABLED: + continue + info = mlist.getBounceInfo(member) + if info.score >= mlist.bounce_score_threshold: + disables.append((member, info)) + if disables: + mlist.Lock() + try: + for member, info in disables: + mlist.disableBouncingMember(member, info, msg) + mlist.Save() + finally: + mlist.Unlock() # Go through all the members who have delivery disabled due to # bouncing, and find those that are due to have another notification. members = mlist.getDeliveryStatusMembers((MemberAdaptor.BYBOUNCE,)) for member in members: info = mlist.getBounceInfo(member) if not info: - # Hmm... + syslog('error', + '%s disabled BYBOUNCE but lacks bounce info, list: %s', + member, mlist.internal_name()) continue lastnotice = time.mktime(info.lastnotice + (0,) * 6) if today >= lastnotice + interval: @@ -105,6 +132,8 @@ def main(): mlist.Lock() try: for member in notify: + syslog('bounce', 'Notifying disabled member %s for list: %s', + member, mlist.internal_name()) mlist.sendNextNotification(member) mlist.Save() finally: |
