🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #35361

Re: Using a separate machine for readers

#35361
From: Brad Knowles
Date: Thu, 11 Feb 1999 00:00
77 lines
3762 bytes
In article <brad-1102991128380001@brad.techos.skynet.be>,
brad@shub-internet.org (Brad Knowles) wrote:

>     This is extremely crude, but here's what we've now got for
> light-history.pl (from what I can tell, it lops off about 1/3 the number
> of bytes and 1/2 the number of lines in the master history file, making
> the new one 2422115 lines long, versus 4337514):

    Actually, that was a bit premature.  I just realized that I didn't fix
the second processing loop.

    Let's try this instead (of course, you then need to follow this up
with a process on the reader boxes that take this new readers-history file
and use it as input to the makehistory command that is run locally):

#!/usr/local/bin/perl
#
# light-history -- take the master history file, toss out the stuff that 
#               readers don't need, keep the rest
#               Typically reduces # of lines to 55% and # of bytes to 65%

open(IN,"</usr/local/news/db/history") or die "Cannot read history";
open(OUT,">/usr/local/news/db/readers-history.n") or die "Cannot write
light history";

# Let's process as many old articles as we can, before pausing the server 
# and flushing the most recent articles
while(<IN>) {

# Let's process as many old articles as we can (seeking to EOF), before
# pausing the server and flushing the most recent articles
while(<IN>) {
        # Keep normal articles
        if (/(^<\S+>)\s+(\d+~-~\d+)\s+(\S+)/) {
                print OUT "$1\t$2\t$3\n";
        }
        # Keep those with Expires headers, too
        elsif (/(^<\S+>)\s+(\d+~\d+~\d+)\s+(\S+)/) {
                print OUT "$1\t$2\t$3\n";
        }
}

print "Throttling\n";
system('ctlinnd throttle "Making light history"');
print "Flushing\n";
system('ctlinnd flush historyd!');
print "Flushing\n";
system('ctlinnd flush historyd!');

# Process the articles most recently added
while(<IN>) {
        # Keep normal articles
        if (/(^<\S+>)\s+(\d+~-~\d+)\s+(\S+)/) {
                print OUT "$1\t$2\t$3\n";
        }
        # Keep those with Expires headers, too
        elsif (/(^<\S+>)\s+(\d+~\d+~\d+)\s+(\S+)/) {
                print OUT "$1\t$2\t$3\n";
        }
}

print "Un-throttling\n";
system('ctlinnd go "Making light history"');

close(OUT);
close(IN);

system('mv /usr/local/news/db/readers-history.n
/usr/local/news/db/readers-history');

-- 
Brad Knowles <brad@shub-internet.org> <http://www.shub-internet.org/brad/>
    <http://wwwkeys.pgp.net:11371/pks/lookup?op=get&search=0xE38CCEF1>
        If you wouldn't take out a one-page ad in the Wall Street
        Journal to say something, then don't say it by email.

Technical Details
Message-ID: <brad-1102991155520001@brad.techos.skynet.be>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!not-for-mail
References: <79qni9$a7j$1@mulga.cs.mu.OZ.AU> <brad-1002991259050001@brad.techos.skynet.be> <79s5ri$5jq8$1@newssvr03-int.news.prodigy.com> <brad-1002991739080001@brad.techos.skynet.be> <87ww1qvul9.fsf@erlenstar.demon.co.uk> <brad-1002992328020001@brad.techos.skynet.be> <79t2se$bmg@dfw-ixnews7.ix.netcom.com> <brad-1102991128380001@brad.techos.skynet.be>

Show Full Headers
Complete Article Headers
Message-ID: <brad-1102991155520001@brad.techos.skynet.be>
Subject: Re: Using a separate machine for readers
Date: Thu, 11 Feb 1999 00:00:00 +0000
From: brad@shub-internet.org (Brad Knowles)
References: <79qni9$a7j$1@mulga.cs.mu.OZ.AU> <brad-1002991259050001@brad.techos.skynet.be> <79s5ri$5jq8$1@newssvr03-int.news.prodigy.com> <brad-1002991739080001@brad.techos.skynet.be> <87ww1qvul9.fsf@erlenstar.demon.co.uk> <brad-1002992328020001@brad.techos.skynet.be> <79t2se$bmg@dfw-ixnews7.ix.netcom.com> <brad-1102991128380001@brad.techos.skynet.be>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!not-for-mail
X-Deja-AN: 443169514
X-Complaints-To: abuse@skynet.be
X-Trace: news1.skynet.be 918730560 16516 195.238.1.121 (11 Feb 1999 10:56:00 GMT)
Organization: Shub-Internet
X-URL: http://www.shub-internet.org/
NNTP-Posting-Date: 11 Feb 1999 10:56:00 GMT
Newsgroups: news.software.nntp