From 8e33ae27a67549dd2c8e9ed68862df57a2daf122 Mon Sep 17 00:00:00 2001 From: Mark Sapiro Date: Tue, 2 Dec 2008 14:37:29 -0800 Subject: If we somehow retrieve a message from the newsgroup with no headers, skip trying to post it to the list. Make sure we always update the watermark even if the message is empty or unparseable. --- cron/gate_news | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'cron/gate_news') diff --git a/cron/gate_news b/cron/gate_news index a44257cd..9eea84ce 100755 --- a/cron/gate_news +++ b/cron/gate_news @@ -131,6 +131,9 @@ def poll_newsgroup(mlist, conn, first, last, glock): glock.refresh() try: headers = conn.head(`num`)[3] + # I don't know how this happens, but skip an empty message. + if not headers: + raise _ContinueLoop found_to = 0 beenthere = 0 for header in headers: @@ -184,9 +187,12 @@ def poll_newsgroup(mlist, conn, first, last, glock): syslog('fromusenet', str(e)) except _ContinueLoop: continue - # Even if we don't post the message because it was seen on the - # list already, update the watermark - mlist.usenet_watermark = num + # Even if we don't post the message because it was seen on the + # list already, or if we skipped it as unparseable or empty, + # update the watermark. Note this used to be in the 'for' block + # but if the last message(s) raised _ContinueLoop, they wouldn't + # update the watermark. + mlist.usenet_watermark = num -- cgit v1.2.3