about summary refs log tree commit homepage
path: root/lib
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2022-10-20 08:43:09 +0000
committerEric Wong <e@80x24.org>2022-10-24 08:18:24 +0000
commit8816336b59c9dd0b26c8620668a01b66c0818a1e (patch)
treeb7a67f869c40484df78a426e7456d6f5ca9d65dc /lib
parent0881010d123914be5e47544229e2b03412a6a691 (diff)
downloadpublic-inbox-8816336b59c9dd0b26c8620668a01b66c0818a1e.tar.gz
When we cull manifest.js.gz for ignored epochs, attempt to
preserve mtime of the updated manifest.js.gz since it can
be used to optimize future fetches.
Diffstat (limited to 'lib')
-rw-r--r--lib/PublicInbox/Fetch.pm2
-rw-r--r--lib/PublicInbox/LeiMirror.pm2
2 files changed, 4 insertions, 0 deletions
diff --git a/lib/PublicInbox/Fetch.pm b/lib/PublicInbox/Fetch.pm
index 5261cad1..364271e8 100644
--- a/lib/PublicInbox/Fetch.pm
+++ b/lib/PublicInbox/Fetch.pm
@@ -221,7 +221,9 @@ EOM
                 if ($mculled) {
                         my $json = PublicInbox::Config->json->encode($m1);
                         my $fn = $ft->filename;
+                        my $mtime = (stat($fn))[9];
                         gzip(\$json => $fn) or die "gzip: $GzipError";
+                        utime($mtime, $mtime, $fn) or die "utime(..., $fn): $!";
                 }
                 PublicInbox::LeiMirror::ft_rename($ft, $mf, 0666);
         }
diff --git a/lib/PublicInbox/LeiMirror.pm b/lib/PublicInbox/LeiMirror.pm
index e20d30b4..fa1d2e88 100644
--- a/lib/PublicInbox/LeiMirror.pm
+++ b/lib/PublicInbox/LeiMirror.pm
@@ -408,7 +408,9 @@ EOM
                 # users won't have to delete manifest if they +w an
                 # epoch they no longer want to skip
                 my $json = PublicInbox::Config->json->encode($m);
+                my $mtime = (stat($fn))[9];
                 gzip(\$json => $fn) or die "gzip: $GzipError";
+                utime($mtime, $mtime, $fn) or die "utime(..., $fn): $!";
         }
         ft_rename($ft, "$self->{dst}/manifest.js.gz", 0666);
 }