]> Sergey Matveev's repositories - public-inbox.git/commitdiff
clone|fetch: preserve mtime of modified manifest.js.gz
authorEric Wong <e@80x24.org>
Thu, 20 Oct 2022 08:43:09 +0000 (08:43 +0000)
committerEric Wong <e@80x24.org>
Mon, 24 Oct 2022 08:18:24 +0000 (08:18 +0000)
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.

lib/PublicInbox/Fetch.pm
lib/PublicInbox/LeiMirror.pm

index 5261cad198552883ce162ea0fa3b84e908939da1..364271e8ccd918537db42ae01e3d0d6734ed84fa 100644 (file)
@@ -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);
        }
index e20d30b48546fc9c1344d78b9d699858af4db0a6..fa1d2e88b20bbec1bf6a745418ab51c141f40381 100644 (file)
@@ -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);
 }