public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Ondrej Vasik <ovasik@fedoraproject.org>
To: git-commits@fedoraproject.org
Subject: [rpms/inn] epel10.3: add support for load average to makehistory(#276061)
Date: Wed, 26 Aug 2026 08:53:57 GMT	[thread overview]
Message-ID: <178773443736.1.262069797143919829.rpms-inn-b8cfaec611d3@fedoraproject.org> (raw)

A new commit has been pushed.

Repo   : rpms/inn
Branch : epel10.3
Commit : b8cfaec611d3ea0ac1edafa62b696f713c0ffaa1
Author : Ondrej Vasik <ovasik@fedoraproject.org>
Date   : 2009-06-24T08:09:45+00:00
Stats  : +130/-1 in 2 file(s)
URL    : https://src.fedoraproject.org/rpms/inn/c/b8cfaec611d3ea0ac1edafa62b696f713c0ffaa1?branch=epel10.3

Log:
add support for load average to makehistory(#276061)

---
diff --git a/inn-2.5.0-loadaverage.patch b/inn-2.5.0-loadaverage.patch
new file mode 100644
index 0000000..88c548c
--- /dev/null
+++ b/inn-2.5.0-loadaverage.patch
@@ -0,0 +1,126 @@
+diff -urNp inn-2.5.0-orig/doc/pod/makehistory.pod inn-2.5.0/doc/pod/makehistory.pod
+--- inn-2.5.0-orig/doc/pod/makehistory.pod	2009-06-24 09:54:24.000000000 +0200
++++ inn-2.5.0/doc/pod/makehistory.pod	2009-06-24 09:56:58.000000000 +0200
+@@ -5,7 +5,7 @@ makehistory - Initialize or rebuild INN 
+ =head1 SYNOPSIS
+ 
+ B<makehistory> [B<-abFIOSx>] [B<-f> I<filename>] [B<-l> I<count>]
+-[B<-s> I<size>] [B<-T> I<tmpdir>]
++[B<-L> I<load-average>] [B<-s> I<size>] [B<-T> I<tmpdir>]
+ 
+ =head1 DESCRIPTION
+ 
+@@ -89,6 +89,16 @@ specify the temporary storage location. 
+ with buffindexed, because buffindexed does not need sorted
+ overview and no batching is done.
+ 
++=item B<-L> I<load-average>
++
++Temporarily pause activities if the system load average exceeds the
++specified level I<load-average>.  This allows B<makehistory> to run
++on a system being used for other purposes without monopolizing system
++resources and thus making the response time for other applications
++unacceptably slow.  Using nice(1) does not help much for that because
++the problem comes from disk I/O usage, and ionice(1) is not always
++available or efficient.
++
+ =item B<-O>
+ 
+ Create the overview database as well as the F<history> file.  Overview
+diff -urNp inn-2.5.0-orig/expire/makehistory.c inn-2.5.0/expire/makehistory.c
+--- inn-2.5.0-orig/expire/makehistory.c	2009-06-24 09:54:24.000000000 +0200
++++ inn-2.5.0/expire/makehistory.c	2009-06-24 10:05:02.000000000 +0200
+@@ -24,8 +24,28 @@
+ #include "inn/vector.h"
+ #include "inn/wire.h"
+ 
++/*
++**  If we have getloadavg, include the appropriate header file.  Otherwise,
++**  just assume that we always have a load of 0.
++*/
++#if HAVE_GETLOADAVG
++# if HAVE_SYS_LOADAVG_H
++#  include <sys/loadavg.h>
++# endif
++#else
++static int
++getloadavg(double loadavg[], int nelem)
++{
++   int i;
++
++   for (i = 0; i < nelem && i < 3; i++)
++        loadavg[i] = 0;
++   return i;
++}
++#endif
++
+ static const char usage[] = "\
+-Usage: makehistory [-abFIOSx] [-f file] [-l count] [-s size] [-T tmpdir]\n\
++Usage: makehistory [-abFIOSx] [-f file] [-l count] [-L load] [-s size] [-T tmpdir]\n\
+ \n\
+     -a          open output history file in append mode\n\
+     -b          delete bad articles from spool\n\
+@@ -33,6 +53,7 @@ Usage: makehistory [-abFIOSx] [-f file] 
+     -f file     write history entries to file (default $pathdb/history)\n\
+     -I          do not create overview for articles numbered below lowmark\n\
+     -l count    size of overview updates (default 10000)\n\
++    -L load     pause when load average exceeds threshold\n\
+     -O          create overview entries for articles\n\
+     -S          write overview data to standard output\n\
+     -s size     size new history database for approximately size entries\n\
+@@ -810,6 +831,8 @@ main(int argc, char **argv)
+ {
+     ARTHANDLE *art = NULL;
+     bool AppendMode;
++    int LoadAverage;
++    double load[1];
+     int i;
+     bool val;
+     char *HistoryDir;
+@@ -837,9 +860,10 @@ main(int argc, char **argv)
+     DoOverview = false;
+     Fork = false;
+     AppendMode = false;
++    LoadAverage = 0;
+     NoHistory = false;
+ 
+-    while ((i = getopt(argc, argv, "abFf:Il:OSs:T:x")) != EOF) {
++    while ((i = getopt(argc, argv, "abFf:Il:L:OSs:T:x")) != EOF) {
+ 	switch(i) {
+ 	case 'a':
+ 	    AppendMode = true;
+@@ -859,6 +883,9 @@ main(int argc, char **argv)
+ 	case 'l':
+ 	    OverTmpSegSize = atoi(optarg);
+ 	    break;
++	case 'L':
++	    LoadAverage = atoi(optarg);
++	    break;
+ 	case 'O':
+ 	    DoOverview = true;
+ 	    break;
+@@ -956,7 +983,7 @@ main(int argc, char **argv)
+ 
+     /*
+      * Scan the entire spool, nuke any bad arts if needed, and process each
+-     * article.
++     * article. We take a break when the load is too high.
+      */
+ 	
+     while ((art = SMnext(art, RETR_ALL)) != NULL) {
+@@ -965,7 +992,15 @@ main(int argc, char **argv)
+ 		SMcancel(*art->token);
+ 	    continue;
+ 	}
++
+ 	DoArt(art);
++
++        if (LoadAverage > 0) {
++            while (getloadavg(load, 1) > 0 &&
++                   (int) (load[0]) >= LoadAverage) {
++                 sleep(1);
++            }
++        }
+     }
+ 
+     if (!NoHistory) {

diff --git a/inn.spec b/inn.spec
index ad6c2ac..7ac2f92 100644
--- a/inn.spec
+++ b/inn.spec
@@ -1,7 +1,7 @@
 Summary: The InterNetNews system, an Usenet news server
 Name: inn
 Version: 2.5.0
-Release: 1
+Release: 2
 #see LICENSE file for details
 License: GPL+ and BSD and MIT and Public Domain
 Group: System Environment/Daemons
@@ -354,6 +354,9 @@ exit 0
 %{_mandir}/man1/inews*
 
 %changelog
+* Wed Jun 24 2009 Ondrej Vasik <ovasik@redhat.com> - 2.5.0-2
+- add support for load average to makehistory(#276061)
+
 * Tue Jun 09 2009 Ondrej Vasik <ovasik@redhat.com> - 2.5.0-1
 - new upstream release 2.5.0
 - remove applied and adjust modified patches

                 reply	other threads:[~2026-08-26  8:53 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=178773443736.1.262069797143919829.rpms-inn-b8cfaec611d3@fedoraproject.org \
    --to=ovasik@fedoraproject.org \
    --cc=git-commits@fedoraproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox