[comp.sources.bugs] C News fix for unstalled batching

chip@ateng.com (Chip Salzenberg) (11/15/89)

One of the sites that we feed hasn't been keeping up with their batches.
In fact, they've fallen so far behind that entire batches that should be
100K are empty because all the articles in them have expired.

Unfortunately, the C News sendbatches program doesn't notice when an
outgoing batch is empty.  It sends it anyway.  Therefore, today the outgoing
queue to this problem site was full of 20 empty batches.  The fullness of
the outgoing queue prevented the enqueuing of any non-empty batches.

This patch should fix that bug.  It notices the size of an outgoing batch,
and if the batch is empty, it doesn't send it.

*** sendbatches.P	Tue Sep 19 14:36:45 1989
--- sendbatches	Tue Nov 14 13:28:48 1989
***************
*** 144,152 ****
  		for f in $them
  		do
! 			( $batcher -d $NEWSARTS $f | $muncher |
! 						$sender $sys ) >/tmp/nb$$ 2>&1
  			if test $? -eq 0 -a ! -s /tmp/nb$$
  			then
! 				rm -f $f /tmp/nb$$
  			else
  				(
--- 144,157 ----
  		for f in $them
  		do
! 			$batcher -d $NEWSARTS $f >/tmp/b$$
! 			if test ! -s /tmp/b$$
! 			then
! 				rm -f $f /tmp/b$$
! 				continue
! 			fi
! 			( $muncher | $sender $sys ) </tmp/b$$ >/tmp/nb$$ 2>&1
  			if test $? -eq 0 -a ! -s /tmp/nb$$
  			then
! 				rm -f $f /tmp/b$$ /tmp/nb$$
  			else
  				(

I hope this patch will meet with the approval of the C News Cabal -- er,
authors.  (Hey, yeah!  "C" stands for Cabal!  That's the ticket!)
-- 
You may redistribute this article only to those who may freely do likewise.
Chip Salzenberg at A T Engineering;  <chip@ateng.com> or <uunet!ateng!chip>

henry@utzoo.uucp (Henry Spencer) (11/16/89)

In article <25605C32.28948@ateng.com> chip@ateng.com (Chip Salzenberg) writes:
>One of the sites that we feed hasn't been keeping up with their batches.
>In fact, they've fallen so far behind that entire batches that should be
>100K are empty because all the articles in them have expired.
>Unfortunately, the C News sendbatches program doesn't notice when an
>outgoing batch is empty...
>I hope this patch will meet with the approval of the C News Cabal -- er,
>authors...

I'd be happier about it if it didn't involve running every batch through
a temporary file.  This can be a noticeable performance hit, and *most*
of the time it's unnecessary.

I would recommend Chip's solution as an interim measure for sites with
serious problems of this type.  I've got a more elegant solution sketched
out, but it will take a bit of work and won't appear immediately.
-- 
A bit of tolerance is worth a  |     Henry Spencer at U of Toronto Zoology
megabyte of flaming.           | uunet!attcan!utzoo!henry henry@zoo.toronto.edu