🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: news.software.nntp
2 messages
2 total messages Started by David Herron Wed, 17 Nov 1993 18:16
How to get accurate counts of messages in a newsgroup ... ?
#2245
Author: David Herron
Date: Wed, 17 Nov 1993 18:16
41 lines
2693 bytes
Greetings!

I am facing down a problem to which there doesn't seem to be an answer.

The problem is about getting a count of the messages in a newsgroup which
the user has not read.  Rather.. getting this count while not spending
inordinate amounts of time doing so.

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.

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'.  If a hole
exists where the user has already read a message the count gets thrown off.

Since none of the NNTP extensions have been collected into a new RFC (
documented that is) I can only go by the single solitary extension supported
by my friendly neighborhood NNTP server.  Namely: XHDR.  Sending an XHDR
command like

	XHDR "" first-last

returns the list of existant articles while sending the least number of
bytes over the wire.  Unfortunately this takes a significant amount of time
to happen.  Partly in the server since it does a longish pause before
sending the results back, and partly because it's a round trip to the server.


I've implemented this XHDR based solution and found that it gives accurate
counts but that it's too slow to be livable.  The guess is that any other
solution involving round trips to the server will be too slow.

What I am curious about is other peoples solutions to this problem.

<- David Herron <david@twg.com> (work) <david@davids.mmdf.com> (home)
<-
<- There are only two pains- 
<-     The pain of discipline or the pain of regret.
Re: How to get accurate counts of messages in a newsgroup ... ?
#2247
Author: Wayne Davison
Date: Thu, 18 Nov 1993 07:05
52 lines
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
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads