🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: news.software.readers
8 messages
8 total messages Started by Byrial Jensen Mon, 03 May 1999 00:00
slrnpull slow when reading a newsgroup first time
#48339
Author: Byrial Jensen
Date: Mon, 03 May 1999 00:00
24 lines
1333 bytes
Hi,

I have noticed that it may take long time to read from a newsgroup
the first time with slrnpull even if you only request the last few
articles from the group.

It seems to be because slrnpull requests the Message-IDs from
/all/ articles in the group with the NNTP-command

XHDR Message-Id 1-

If it is a high traffic group and/or it has a long expiration time
on the used newsserver, this may give very very many Message-IDs
to download.

I suggest that slrnpull is changed so that it will never request
more Message-IDs from the server than the maximal number of
articles to retrieve in the current newsgoup. Thank you.

-- 
Regards,
Byrial

Re: slrnpull slow when reading a newsgroup first time
#48337
Author: John E. Davis
Date: Mon, 03 May 1999 00:00
133 lines
4648 bytes
On Mon, 03 May 1999 09:10:43 GMT, Byrial Jensen <bjensen@nospam.dk>
wrote:
>I suggest that slrnpull is changed so that it will never request
>more Message-IDs from the server than the maximal number of
>articles to retrieve in the current newsgoup. Thank you.

Try the following patch to slrnpull.c.  This patch also includes the
--logfile feature:

--- ../../release/slrn/src/slrnpull.c	Sun Apr 25 16:41:46 1999
+++ slrnpull.c	Mon May  3 13:01:00 1999
@@ -785,7 +785,8 @@
 
 static unsigned int Num_Duplicates;
 
-static int *list_server_numbers (NNTP_Type *s, Active_Group_Type *g, unsigned int *nump) /*{{{*/
+static int *list_server_numbers (NNTP_Type *s, Active_Group_Type *g, 
+				 int server_max, unsigned int *nump) /*{{{*/
 {
    char *name; 
    unsigned int min, max;
@@ -803,18 +804,20 @@
    /* Server has XHDR.  Good. */
    min = g->min;
    max = g->max + 1;
-#if 0   
-   if (max >= min)
-     max++;
-#else
    if (max < min) max = min;
-#endif
 
-   status = nntp_server_vcmd (s, "XHDR Message-Id %d-", max);
+   /* If this is the first time this group has been visited, then do not grab
+    * all the message-ids when the user specifies a limit to grab.
+    */
+   if ((max <= 1) && (g->max_to_get != 0)
+       && ((unsigned int) server_max > g->max_to_get))
+     max = (unsigned int) server_max - g->max_to_get;
+
+   status = nntp_server_vcmd (s, "XHDR Message-Id %u-", max);
    if (status == -1)
      return NULL;			       /* server closed? */
    
-   if (status == 224) status = OK_HEAD;/* Micro$soft broken server */
+   if (status == 224) status = OK_HEAD;/* Micro$oft broken server */
    if (status != OK_HEAD)
      {
 	log_error ("Server failed XHDR command: %s", s->rspbuf);
@@ -1302,7 +1305,7 @@
      }
 
    Num_Duplicates = 0;
-   numbers = list_server_numbers (s, g, &num_numbers);
+   numbers = list_server_numbers (s, g, server_max, &num_numbers);
    if (Num_Duplicates)
      log_message ("%u duplicates removed leaving %u/%u.", 
 		  Num_Duplicates, num_numbers, num_numbers + Num_Duplicates);
@@ -1695,16 +1698,16 @@
 
 static void init_signals (void);
 
-static void open_log_files (void) /*{{{*/
+static void open_log_files (char *logfile) /*{{{*/
 {
    char file [SLRN_MAX_PATH_LEN + 1];
    
    ELog_Fp = stderr;
    MLog_Fp = stdout;
    
-   if (-1 == slrn_dircat (SlrnPull_Dir, SLRNPULL_LOGFILE, file))
+   if (-1 == slrn_dircat (SlrnPull_Dir, logfile, file))
      return;
-   
+
    MLog_Fp = fopen (file, "a");
    if (MLog_Fp == NULL)
      {
@@ -1743,6 +1746,7 @@
   --no-post         Do not post news\n\
   --new-groups      Get new groups\n\
   --version         Show version number\n\
+  --logfile FILE    Use FILE as the log file\n\
 ",
 	      pgm, pgm);
    close_log_files ();
@@ -1783,7 +1787,8 @@
    int post_mode;
    int check_new_groups = 0;
    char *dir;
-   
+   char *logfile;
+
    pgm = argv[0];
    argv++; argc--;
    
@@ -1793,6 +1798,7 @@
 
    MLog_Fp = stdout;
    ELog_Fp = stderr;
+   logfile = SLRNPULL_LOGFILE;
 
    dir = getenv ("SLRNPULL_ROOT");
    
@@ -1825,6 +1831,11 @@
 	  check_new_groups = 1;
 	else if (!strcmp (arg, "--version"))
 	  show_version (pgm);
+	else if (!strcmp (arg, "--logfile") && (argc > 0))
+	  {
+	     logfile = *argv;
+	     argv++; argc--;
+	  }
 	else usage (pgm);
      }
 
@@ -1837,7 +1848,7 @@
 	return 1;
      }
    
-   open_log_files ();
+   open_log_files (logfile);
 
    if (expire_mode)
      log_message ("slrnpull started in expire mode.");


-- 
John E. Davis                   Center for Space Research/AXAF Science Center
617-258-8119                    One Hampshire St., Building NE80-6019
http://space.mit.edu/~davis     Cambridge, MA  02139-4307

Re: slrnpull slow when reading a newsgroup first time
#48338
Author: Byrial Jensen
Date: Mon, 03 May 1999 00:00
46 lines
2147 bytes
John E. Davis <davis@space.mit.edu> wrote:
>On Mon, 03 May 1999 09:10:43 GMT, Byrial Jensen <bjensen@nospam.dk>
>wrote:
>>I suggest that slrnpull is changed so that it will never request
>>more Message-IDs from the server than the maximal number of
>>articles to retrieve in the current newsgoup. Thank you.
>
>Try the following patch to slrnpull.c.  This patch also includes the
>--logfile feature:

Thnak you very much. I have tried it. I think that it has an
off-by-one error. See this excerpt from the slrnpull-log:

05/03/1999 22:42:38 Fetching articles for dk.snak.
05/03/1999 22:42:39 dk.snak: Retrieving articles 120441-120443.
05/03/1999 22:42:39 dk.snak: 3 articles available.
05/03/1999 22:42:39 dk.snak: Only retrieving last 2 articles.
05/03/1999 22:42:40 dk.snak: 2/2 (0 killed), Time: 00:01:09, BPS: 2093

It sent these commands to the newsserver for the group dk.snak
(as captured with the program tcpflow):

GROUP dk.snak
XHDR Message-Id 120441-
head 120442
head 120443
body 120442
body 120443

The GROUP and XHDR commands returned:

211 10093 106107 120443 dk.snak
221 message-id fields follow
120441 <372f98c5.6837202@news.image.dk>
120442 <373709b1.21305599@news030.image.dk>
120443 <3736094d.21206138@news030.image.dk>
..

So the log report "3 articles available" is one too many -- or
rather 10090 too few ...

-- 
Regards,
Byrial

Re: slrnpull slow when reading a newsgroup first time
#48344
Author: John E. Davis
Date: Mon, 03 May 1999 00:00
23 lines
1702 bytes
On Mon, 03 May 1999 21:35:59 GMT, Byrial Jensen <bjensen@nospam.dk>
wrote:
>So the log report "3 articles available" is one too many -- or
>rather 10090 too few ...

--- slrnpull.c~	Mon May  3 13:01:00 1999
+++ slrnpull.c	Mon May  3 18:32:47 1999
@@ -811,7 +811,7 @@
     */
    if ((max <= 1) && (g->max_to_get != 0)
        && ((unsigned int) server_max > g->max_to_get))
-     max = (unsigned int) server_max - g->max_to_get;
+     max = (unsigned int) server_max - g->max_to_get + 1;
 
    status = nntp_server_vcmd (s, "XHDR Message-Id %u-", max);
    if (status == -1)

-- 
John E. Davis                   Center for Space Research/AXAF Science Center
617-258-8119                    One Hampshire St., Building NE80-6019
http://space.mit.edu/~davis     Cambridge, MA  02139-4307

Re: slrnpull slow when reading a newsgroup first time
#48377
Author: Sylvan Butler
Date: Wed, 05 May 1999 00:00
47 lines
2789 bytes
On Wed, 05 May 1999 12:10:29 GMT, Byrial Jensen <bjensen@nospam.dk> wrote:
>However the log report is still misleading about the number of
>available articles, when it says something like:
>
>05/04/1999 15:17:25 Fetching articles for dk.snak.
>05/04/1999 15:17:26 dk.snak: Retrieving articles 120572-120573.
>05/04/1999 15:17:26 dk.snak: 2 articles available.
>05/04/1999 15:17:27 dk.snak: 2/2 (0 killed), Time: 00:00:08, BPS: 1121
>
>I would instead prefer a log report like this:
>
>05/04/1999 15:17:25 Fetching articles for dk.snak.
>05/04/1999 15:17:26 dk.snak: 10182 articles available.
>05/04/1999 15:17:26 dk.snak: Only retrieving last 2 articles.
>05/04/1999 15:17:26 dk.snak: Retrieving articles 120572-120573.
>05/04/1999 15:17:27 dk.snak: 2/2 (0 killed), Time: 00:00:08, BPS: 1121

Will this do?  (I don't use slrnpull.c, so maybe I don't have the
right numbers in that message...  But the numbers you wanted aren't
even readily available.)

diff -u slrnpull.c.orig slrnpull.c
--- slrnpull.c.orig     Wed May  5 12:09:07 1999
+++ slrnpull.c  Wed May  5 12:28:46 1999
@@ -810,8 +810,11 @@
     * all the message-ids when the user specifies a limit to grab.
     */
    if ((max <= 1) && (g->max_to_get != 0)
-       && ((unsigned int) server_max > g->max_to_get))
+       && ((unsigned int) server_max > g->max_to_get)) {
      max = (unsigned int) server_max - g->max_to_get + 1;
+     log_message ("%s: Attempting last %u/%u articles.",
+       g->name, g->max_to_get, server_max);
+   }

    status = nntp_server_vcmd (s, "XHDR Message-Id %u-", max);
    if (status == -1)

sdb
-- 
 | Sylvan Butler | Not speaking for Hewlett-Packard | sbutler-boi.hp.com |
 | Watch out for my e-mail address. Thank UCE.   #### change ^ to @ #### |
    They that can give up essential liberty to obtain a little temporary
    safety deserve neither liberty nor safety. --Benjamin Franklin, 1759
 "Don't Tread On Me!"

Re: slrnpull slow when reading a newsgroup first time
#48381
Author: John E. Davis
Date: Wed, 05 May 1999 00:00
15 lines
1641 bytes
On Wed, 05 May 1999 12:10:29 GMT, Byrial Jensen <bjensen@nospam.dk>
wrote:
>However the log report is still misleading about the number of
>available articles, when it says something like:

You cannot have it both ways.  If you do not want to download all the
message-ids to know exactly how many there are, then the best that can
be done is to use the min/max article numbers on the server and make a
guess that there are max-min+1 articles available.
-- 
John E. Davis                   Center for Space Research/AXAF Science Center
617-258-8119                    One Hampshire St., Building NE80-6019
http://space.mit.edu/~davis     Cambridge, MA  02139-4307

Re: slrnpull slow when reading a newsgroup first time
#48389
Author: Byrial Jensen
Date: Wed, 05 May 1999 00:00
27 lines
1704 bytes
John E. Davis <davis@space.mit.edu> wrote:
>[patch]

Thank you again. It now does the right thing (when you visit a
group first time).

However the log report is still misleading about the number of
available articles, when it says something like:

05/04/1999 15:17:25 Fetching articles for dk.snak.
05/04/1999 15:17:26 dk.snak: Retrieving articles 120572-120573.
05/04/1999 15:17:26 dk.snak: 2 articles available.
05/04/1999 15:17:27 dk.snak: 2/2 (0 killed), Time: 00:00:08, BPS: 1121

I would instead prefer a log report like this:

05/04/1999 15:17:25 Fetching articles for dk.snak.
05/04/1999 15:17:26 dk.snak: 10182 articles available.
05/04/1999 15:17:26 dk.snak: Only retrieving last 2 articles.
05/04/1999 15:17:26 dk.snak: Retrieving articles 120572-120573.
05/04/1999 15:17:27 dk.snak: 2/2 (0 killed), Time: 00:00:08, BPS: 1121

-- 
Regards,
Byrial

Re: slrnpull slow when reading a newsgroup first time
#48399
Author: Byrial Jensen
Date: Wed, 05 May 1999 00:00
59 lines
3087 bytes
Sylvan Butler <nospam+_no_Zs__9905@hpb13799z.zboi.hpz.com.invalid> wrote:
>Will this do?  (I don't use slrnpull.c, so maybe I don't have the
>right numbers in that message...  But the numbers you wanted aren't
>even readily available.)
>
>[patch]

Yes, something like that will do fine. I don't care about the
exact number of skipped articles, but I want a log message that
is more informative than misleading.

I had been looking at the code myself when I saw your patch. So
here is my suggestion at a change. It improves the condition for
when some articles are skipped by using also the first article
number in the group, and writes a message to the log when it
happens.

--- slrnpull.c~	Wed May  5 23:37:55 1999
+++ slrnpull.c	Wed May  5 23:27:51 1999
@@ -786,7 +786,8 @@ static int *listgroup_numbers (NNTP_Type
 static unsigned int Num_Duplicates;
 
 static int *list_server_numbers (NNTP_Type *s, Active_Group_Type *g, 
-				 int server_max, unsigned int *nump) /*{{{*/
+				 int server_min, int server_max,
+				 unsigned int *nump) /*{{{*/
 {
    char *name; 
    unsigned int min, max;
@@ -810,8 +811,12 @@ static int *list_server_numbers (NNTP_Ty
     * all the message-ids when the user specifies a limit to grab.
     */
    if ((max <= 1) && (g->max_to_get != 0)
-       && ((unsigned int) server_max > g->max_to_get))
-     max = (unsigned int) server_max - g->max_to_get + 1;
+       && (g->max_to_get < server_max - server_min + 1))
+     {
+	max = (unsigned int) server_max - g->max_to_get + 1;
+	log_message ("%s: Skipping articles %d-%d.", g->name,
+		     server_min, max - 1);
+     }
 
    status = nntp_server_vcmd (s, "XHDR Message-Id %u-", max);
    if (status == -1)
@@ -1305,7 +1310,7 @@ static int get_group_articles (NNTP_Type
      }
 
    Num_Duplicates = 0;
-   numbers = list_server_numbers (s, g, server_max, &num_numbers);
+   numbers = list_server_numbers (s, g, server_min, server_max, &num_numbers);
    if (Num_Duplicates)
      log_message ("%u duplicates removed leaving %u/%u.", 
 		  Num_Duplicates, num_numbers, num_numbers + Num_Duplicates);

-- 
Regards,
Byrial

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