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     | 2 ++
 lib/PublicInbox/LeiMirror.pm | 2 ++
 2 files changed, 4 insertions(+)

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);
 }

Reply via email to