dave@onfcanim.UUCP (Dave Martindale) (08/19/88)
When using the batched ihave/sendme ("I" in the sys file's 3rd field), rnews writes message-id's into a batch file. Then, when sendbatch -i is invoked, it picks up the collected list of message-id's and generates a single "ihave" control message from them. Generally, this control message is added to the normal batch file, and then the whole thing is packed up and sent off to the remote machine. Unfortunately, the code which does this is inside a loop, and if rnews is running at the time sendbatch is invoked, rnews is writing new lines to the file every second or so. Sendbatch generates the "ihave" message, then perhaps a regular batch. Then it notices that there is another sysname.ihave file present, and generates another ihave message with only 1 or 2 articles in it. The result is many ihave messages containing only a few articles, all generated within a few seconds of each other. However, there is no need to put the "ihave" handling inside a loop at all, since all pending message-id's are put into a single article. Below is a context diff of the changes necessary to do the "ihave" processing once, before the normal batching code. (The diffs are for news 2.11, patchlevel 14, and may not apply exactly to older versions). (Note that the normal batching code does not have this "many little tiny files" problem, because it checks for the presence of the main batch file only on the first pass through the loop, when sentbytes == 0.) Dave Martindale *** /tmp/sendbatch.sh.orig Fri Aug 19 10:39:26 1988 --- /tmp/sendbatch.sh Fri Aug 19 10:39:26 1988 *************** *** 64,92 **** BLIM=$LIM fi : make sure $? is zero sentbytes=0 while test $? -eq 0 -a $sentbytes -le $MAXBATCH -a \ \( \( $sentbytes -eq 0 -a -s BATCHDIR/$rmt \) -o \ ! -s BATCHDIR/$rmt.work -o \ ! \( -n "$DOIHAVE" -a -s BATCHDIR/$rmt.ihave \) \) do ! if test -n "$DOIHAVE" -a -s BATCHDIR/$rmt.ihave then ! mv BATCHDIR/$rmt.ihave BATCHDIR/$rmt.$$ ! LIBDIR/inews -t "cmsg ihave $DOIHAVE" -n to.$rmt.ctl < \ ! BATCHDIR/$rmt.$$ ! rm BATCHDIR/$rmt.$$ ! else ! (eval $ECHO; eval $CMD $COMP $C7) | ! if test -s BATCHDIR/$rmt.cmd ! then ! BATCHDIR/$rmt.cmd ! else ! uux - UUXFLAGS $rmt!$RNEWS ! fi ! sentbytes=`expr $sentbytes + $LIM` fi done done --- 64,89 ---- BLIM=$LIM fi + if test -n "$DOIHAVE" -a -s BATCHDIR/$rmt.ihave + then + mv BATCHDIR/$rmt.ihave BATCHDIR/$rmt.$$ + LIBDIR/inews -t "cmsg ihave $DOIHAVE" -n to.$rmt.ctl < \ + BATCHDIR/$rmt.$$ + rm BATCHDIR/$rmt.$$ + fi : make sure $? is zero sentbytes=0 while test $? -eq 0 -a $sentbytes -le $MAXBATCH -a \ \( \( $sentbytes -eq 0 -a -s BATCHDIR/$rmt \) -o \ ! -s BATCHDIR/$rmt.work \) do ! (eval $ECHO; eval $CMD $COMP $C7) | ! if test -s BATCHDIR/$rmt.cmd then ! BATCHDIR/$rmt.cmd else ! uux - UUXFLAGS $rmt!$RNEWS fi + sentbytes=`expr $sentbytes + $LIM` done done