🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.admin.peering
Article #1628

Re: Newbie question

#1628
From: Julien ÉLIE
Date: Thu, 13 Apr 2023 11:55
82 lines
4740 bytes
Hi Eli,

> But I modified pullnews with the line below and this seems to work fine:
>
> if (defined $watermark) {
>      printf LOG "\tOur previous highest: %d\n", $prevHigh if not $quiet;
>      $high = $watermark;
>      $high = $last + $watermark if substr($watermark, 0, 1) eq '-';
> +    $high = $prevHigh if $prevHigh > 0;
>      $high = 0 if $high < 0;
>      $shash->{$group} = [time, $high];
> }

I am unsure this change does what you expected.
On *each* run, including the first one before any timeout occurs, $high will be forced to $prevHigh, and therefore -w won't be taken into account.
$prevHigh is the highest article number previously downloaded (as recorded in pullnews.marks).  In case it is "0" or unset in pullnews.marks, -w will work, but in case pullnews.marks has for instance recorded 500, and you use "-w -100", nothing will happen ($high won't be set to 400 to force the re-downloading of the latest 100 articles).

I would suggest the following patch instead:

--- a/frontends/pullnews
+++ b/frontends/pullnews
@@ -560,6 +560,7 @@ if (not $quiet and not $quietness) {
  }
  
  my $connectionAttempts = 0;
+my %groupsStarted = ();
  
  UPSTREAM:
  foreach my $server (@servers) {
@@ -689,6 +690,7 @@ foreach my $server (@servers) {
  } continue {
      # Reinitialize the counter for the next server.
      $connectionAttempts = 0;
+    %groupsStarted = ();
  }
  
  saveConfig();
@@ -852,12 +854,17 @@ sub crossFeedGroup {
          printf LOG "\t%d article%s available (first %d, last %d)\n",
            $narticles, $narticles != 1 ? "s" : "", $first, $last;
      }
-    if (defined $watermark) {
+
+    # Do not set several times the water mark to another value.  Just go on
+    # downloading articles from the last retrieved one when the connection
+    # timed out.
+    if (defined($watermark) and !exists($groupsStarted{$group})) {
          printf LOG "\tOur previous highest: %d\n", $prevHigh if not $quiet;
          $high = $watermark;
          $high = $last + $watermark if substr($watermark, 0, 1) eq '-';
          $high = 0 if $high < 0;
          $shash->{$group} = [time, $high];
+        $groupsStarted{$group} = 1;
      }
      printf LOG "\tOur current highest: %d", $high if not $quiet;
  





Incidentally, I see that "pullnews -w" just sets the watermark without downloading articles in the same run.
pullnews -w -100 modifies 500 in pullnews.marks to 400, and exits.  I have to run pullnews again to actually download the articles.
It should not be this way I think.  Suggestion of another fix:

@@ -876,7 +883,7 @@ sub crossFeedGroup {
          $high = $first + floor(($last - $first + 1) * (1 - $opt_b));
          $toget = $last - $high;
          print LOG " (reset highwater mark to $high)" unless $quiet;
-    } elsif ($prevHigh == -1 || $last <= $prevHigh) {
+    } elsif ($prevHigh == -1 || $last <= $high) {
          # We connected OK but there's nothing there, or we just want
          # to reset our highwater mark.
          $shash->{$group} = [time, $high];


-- 
Julien ÉLIE

« – Par Thor !
   – Par Odin !
   – Par exemple ! » (Astérix)
Technical Details
Message-ID: <u18qj9$1d4c4$2@news.trigofacile.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!apf1.newsdeef.eu!not-for-mail
References: <sXMOL.4024495$MJk2.1098149@fx06.ams4> <u13bps$188ar$4@news.trigofacile.com> <4IgZL.4406762$WRz3.2096474@fx03.ams4> <u15qd4$1aneb$2@news.trigofacile.com> <OrvZL.2104725$THq2.706453@fx08.ams4>

Show Full Headers
Complete Article Headers
Message-ID: <u18qj9$1d4c4$2@news.trigofacile.com>
Subject: Re: Newbie question
Date: Thu, 13 Apr 2023 13:55:20 +0200
From: Julien ÉLIE <iulius@nom-de-mon-site.com.invalid>
References: <sXMOL.4024495$MJk2.1098149@fx06.ams4> <u13bps$188ar$4@news.trigofacile.com> <4IgZL.4406762$WRz3.2096474@fx03.ams4> <u15qd4$1aneb$2@news.trigofacile.com> <OrvZL.2104725$THq2.706453@fx08.ams4>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!apf1.newsdeef.eu!not-for-mail
Newsgroups: news.admin.peering
Supersedes: <u18p2t$1d4c4$1@news.trigofacile.com>
Organization: Groupes francophones par TrigoFACILE
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Thu, 13 Apr 2023 11:55:21 -0000 (UTC)
Injection-Info: news.trigofacile.com; posting-account="julien"; posting-host="176.143-2-105.abo.bbox.fr:176.143.2.105"; logging-data="1479044"; mail-complaints-to="abuse@trigofacile.com"
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.9.1
Cancel-Key: sha1:zk8ZnEv34KZ4grFL/ZnZYN/tsp4= sha256:GSrImKxQQvF8dLHMOvpeWXS/HxAd0r/llS9GOjQajLk=
Cancel-Lock: sha1:VqYcaP0C6x16F12sUWehLSwwAiU= sha256:UFC4fQ/buztcWGPaK4i6FWtaUvPVpeyd5vwTxSbbCr0= sha1:x/K0RtV3JqLxU0c+X3t1EMnIh2c= sha256:XIl8loLgwU4xw1e4GI12yY8/vDSZJs/L76zdG0e9Xmc=
In-Reply-To: <OrvZL.2104725$THq2.706453@fx08.ams4>