[Piuparts-commits] [piuparts] 04/05: p-r: randomize the rewriting delay between 1 and 4 weeks

Holger Levsen holger at layer-acht.org
Sat Mar 18 12:51:11 UTC 2017


This is an automated email from the git hooks/post-receive script.

holger pushed a commit to branch develop
in repository piuparts.

commit cd518efc5eebe5f75d771a5858174d533a422f6a
Author: Andreas Beckmann <anbe at debian.org>
Date:   Sat Mar 18 12:58:01 2017 +0100

    p-r: randomize the rewriting delay between 1 and 4 weeks
    
    Signed-off-by: Andreas Beckmann <anbe at debian.org>
    Signed-off-by: Holger Levsen <holger at layer-acht.org>
---
 debian/changelog   |  3 ++-
 piuparts-report.py | 11 +++++++++--
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 7dd90b8..14773b3 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -25,7 +25,8 @@ piuparts (0.77) UNRELEASED; urgency=medium
     - Plot all states in the graphs.
     - Support new states in plots (varying number of columns in counts.txt).
     - Reorder stacking in the bts_stats plot.
-    - Defer rewriting unmodified maintainer and source summaries.
+    - Defer rewriting unmodified maintainer and source summaries, refresh them
+      once per month.
   * custom-scripts: Check for dummy package "TARBALL" to detect tarball
     creation phase.
   * master-bin/detect_archive_issues:
diff --git a/piuparts-report.py b/piuparts-report.py
index c9b9acd..ec64a40 100644
--- a/piuparts-report.py
+++ b/piuparts-report.py
@@ -38,6 +38,7 @@ import string
 import yaml
 import hashlib
 import pickle
+import random
 from urllib2 import HTTPError
 
 # if python-rpy2 ain't installed, we don't draw fancy graphs
@@ -704,7 +705,10 @@ def write_template_html(filename, body, mapping={}, defer_if_unmodified=False, m
     if defer_if_unmodified:
         if filename in md5cache['old'] and md5cache['old'][filename] == content_md5 and os.path.exists(filename):
             md5cache['unmodified'] += 1
-            if fileage(filename) < 7 * 86400:
+            # defer updating the file between 1 and 4 weeks
+            minage = 1 * 7 * 86400
+            maxage = 4 * 7 * 86400
+            if fileage(filename) < random.randint(minage, maxage):
                 return
             md5cache['refreshed'] += 1
 
@@ -718,7 +722,10 @@ def write_template_html(filename, body, mapping={}, defer_if_unmodified=False, m
                     break
                 if line.startswith("<!-- ") and line[5:5 + len(content_md5)] == content_md5:
                     md5cache['unmodified'] += 1
-                    if fileage(filename) < 7 * 86400:
+                    # defer updating the file between 1 and 4 weeks
+                    minage = 1 * 7 * 86400
+                    maxage = 4 * 7 * 86400
+                    if fileage(filename) < random.randint(minage, maxage):
                         return
                     md5cache['refreshed'] += 1
                     break

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/piuparts/piuparts.git



More information about the Piuparts-commits mailing list