Article View: news.software.nntp
Article #2247Re: How to get accurate counts of messages in a newsgroup ... ?
From: Wayne Davison
Date: Thu, 18 Nov 1993 07:05
Date: Thu, 18 Nov 1993 07:05
52 lines
3045 bytes
3045 bytes
According to David Herron <david@twg.com>:
> The GROUP command tells us an estimate of the number of articles and the
> range of articles existant. However there frequently are `holes' (missing
> messages) in that range and we have no idea where the holes are.
This is correct except for the "estimate" part. The GROUP command returns
the exact number of existing articles because it reads the directory and
makes a list of all the existing article numbers.
> We keep a list of articles the user has already read. Running through this
> list and subtracting those from the count given us from the GROUP command
> frequently results in a negative number of messages, even though there are
> messages to be read in the group. This is caused by the `holes'.
Which is why you either don't use the count returned by NNTP at all
(use the estimated article count of high - low + 1 and subtract out
all the already-read articles) or you can use the estimated count
minus the real count to set a "known missing" counter that is used
to protect the unread count until you encounter the last known missing
article -- in other words:
known_missing = high - low + 1 - real_count;
unread = real_count;
if (we_encountered_a_missing_article) {
if (known_missing) {
known_missing--;
} else {
unread--;
}
mark_as_missing();
}
> I've implemented this XHDR based solution and found that it gives accurate
> counts but that it's too slow to be livable. [...]
> What I am curious about is other peoples solutions to this problem.
If the server supports LISTGROUP you can use it to list all of the
article numbers and immediately mark them as read. This is a very
fast command since it gets its data directly from the in-memory list
of article numbers that the server keeps.
Besides using LISTGROUP you can use XOVER to get an accurate list of
article numbers from your server if they support overview data. This
is a good way to go if you need to quickly cache the article data
while finding missing articles at the same time (NNTP weeds out the
data for missing articles, but older versions of NNTP might stop short
of supplying the data for the last few articles in a group if it was
newly expanded and the data isn't available yet -- keep this in
mind).
--
Wayne Davison
davison@borland.com
Technical Details
Message-ID:
<CGoECp.Kuy@borland.com>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!archive!mbox2nntp-news.software.readers.mbox.zip!gmd.de!xlink.net!howland.reston.ans.net!usc!elroy.jpl.nasa.gov!decwrl!borland.com!davisonReferences:
<1993Nov17.181701.12747@twg.com>Show Full Headers
Complete Article Headers
Message-ID: <CGoECp.Kuy@borland.com> Subject: Re: How to get accurate counts of messages in a newsgroup ... ? Date: Thu, 18 Nov 1993 07:05:12 GMT From: davison@borland.com (Wayne Davison) References: <1993Nov17.181701.12747@twg.com> Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!archive!mbox2nntp-news.software.readers.mbox.zip!gmd.de!xlink.net!howland.reston.ans.net!usc!elroy.jpl.nasa.gov!decwrl!borland.com!davison Newsgroups: news.software.readers,news.software.nntp Organization: Borland International Lines: 52