From: Eric Wong Date: Thu, 20 Oct 2022 08:43:09 +0000 (+0000) Subject: clone|fetch: preserve mtime of modified manifest.js.gz X-Git-Url: http://www.git.stargrave.org/?p=public-inbox.git;a=commitdiff_plain;h=8816336b59c9dd0b26c8620668a01b66c0818a1e clone|fetch: preserve mtime of modified manifest.js.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. --- 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); }