From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.2 required=3.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id E1F5F1F4DA for ; Thu, 20 Oct 2022 08:43:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=80x24.org; s=selector1; t=1666255394; bh=q+Qou/9FtrCUQHXKrS2g8utUB4YXoSrO8qiXT5opZ6E=; h=From:To:Subject:Date:In-Reply-To:References:From; b=NyOeucS4gJ5QKmJpLRe3sDDJMUvg00YfSK7xvyv8tfpnEjD726Gg7YJ4SXgxBbNml A9unKUEs1H1bNUSUB3cJD9ygFjcKPavYFd9DeozbXUACVLFgF2fRPjwrW9txs7JZU3 5BXtuj+cGmFJU5Y/J99DzwGTU3u2HVbxNDOLv4AI= From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 1/6] clone|fetch: preserve mtime of modified manifest.js.gz Date: Thu, 20 Oct 2022 08:43:09 +0000 Message-Id: <20221020084314.1668067-2-e@80x24.org> In-Reply-To: <20221020084314.1668067-1-e@80x24.org> References: <20221020084314.1668067-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: 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); }