summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbwarsaw1999-12-13 23:43:42 +0000
committerbwarsaw1999-12-13 23:43:42 +0000
commit231bd5d5ab1ae8fbbfce208d5828be8f9fbc54ed (patch)
tree3598f19085de66d64e57843606e3e350132f1d08
parentb4f808e10ef3118b61746ee1b3425487b107c099 (diff)
downloadmailman-231bd5d5ab1ae8fbbfce208d5828be8f9fbc54ed.tar.gz
mailman-231bd5d5ab1ae8fbbfce208d5828be8f9fbc54ed.tar.zst
mailman-231bd5d5ab1ae8fbbfce208d5828be8f9fbc54ed.zip
-rwxr-xr-xcron/gate_news12
1 files changed, 5 insertions, 7 deletions
diff --git a/cron/gate_news b/cron/gate_news
index ece84ab18..84bf99ff0 100755
--- a/cron/gate_news
+++ b/cron/gate_news
@@ -105,7 +105,6 @@ def main():
# number actually gated
children = {}
# cruise through lists
- conn = None
for name in names:
# check to see if the list is gating news to mail. If not, skip the
# list. If so, then we have to poll the newsgroup and gate any
@@ -119,9 +118,6 @@ def main():
# child process, so we do need to open up a new connection for each
# list.
try:
- # close the previous NNTP connection
- if conn:
- conn.quit()
conn = nntplib.NNTP(mlist.nntp_host)
except socket.error, e:
# couldn't open a socket to the NNTP host. maybe we've got too
@@ -133,6 +129,7 @@ def main():
if not updatewatermarks:
# just post the specified messages and be done with it
poll_newsgroup(mlist, conn, first, last+1)
+ conn.quit()
return
# Otherwise, let's figure out what needs to be done
first = int(f)
@@ -197,7 +194,10 @@ def main():
# steal()), but that should be very small.
try:
lock.steal()
- poll_newsgroup(mlist, conn, max(wm+1, first), last+1)
+ try:
+ poll_newsgroup(mlist, conn, max(wm+1, first), last+1)
+ finally:
+ conn.quit()
try:
lock.unlock()
except LockFile.NotLockedError:
@@ -214,8 +214,6 @@ def main():
reap(children, watermarks)
# we're done forking off all the gating children, now just wait for them
# all to exit, and then we're done
- if conn:
- conn.quit()
while children:
reap(children, watermarks)