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=-3.9 required=3.0 tests=ALL_TRUSTED,AWL,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 6F9231FAFD for ; Mon, 28 Nov 2022 05:32:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=80x24.org; s=selector1; t=1669613555; bh=0f1Q8nbuOWkgsJ0PmD02Yh/WpxEIjFUbnTUsCFUeIYg=; h=From:To:Subject:Date:In-Reply-To:References:From; b=GllJLsL+Fx8kp2ctrsF29+v7TXUPgwkmr+B0DmiZhzWcMXoAl0xxBKMuEc/pq0j1z qyBtmlGXoY+dfW02uhOxrudjOITx+N1zjTBbiDpNNUmVxe0Ro0GC9OnPYXvINyYy6u AtKyuAdmpjv61R5p6PJxwAZH2nUH6j9Gpe1TrMjA= From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 14/95] lei_mirror: elide description retrieval for v1|coderepo Date: Mon, 28 Nov 2022 05:31:11 +0000 Message-Id: <20221128053232.291618-15-e@80x24.org> In-Reply-To: <20221128053232.291618-1-e@80x24.org> References: <20221128053232.291618-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: manifest.js.gz can provide the description without an extra HTTP(S) requests, so attempt to use it whenever we're using the manifest. --- lib/PublicInbox/LeiMirror.pm | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/lib/PublicInbox/LeiMirror.pm b/lib/PublicInbox/LeiMirror.pm index da8987be..150b4296 100644 --- a/lib/PublicInbox/LeiMirror.pm +++ b/lib/PublicInbox/LeiMirror.pm @@ -147,9 +147,11 @@ sub _write_inbox_config { open my $fh, '>', $f or die "open($f): $!"; print $fh $buf or die "print: $!"; chmod(0444 & ~umask, $fh) or die "chmod($f): $!"; - my $mtime = delete $self->{'mtime._/text/config/raw'} // die 'BUG: no mtime'; + my $mtime = delete $self->{'mtime._/text/config/raw'}; $fh->flush or die "flush($f): $!"; - utime($mtime, $mtime, $fh) or die "utime($f): $!"; + if (defined $mtime) { + utime($mtime, $mtime, $fh) or die "utime($f): $!"; + } my $cfg = PublicInbox::Config->git_config_dump($f, $self->{lei}->{2}); my $ibx = $self->{ibx} = {}; for my $sec (grep(/\Apublicinbox\./, @{$cfg->{-section_order}})) { @@ -238,8 +240,11 @@ sub clone_v1 { reap_live() while keys(%LIVE) >= $jobs; _get_txt_start($self, '_/text/config/raw', $fini); - _get_txt_start($self, 'description', $fini); - reap_live() until ($nohang || !keys(%LIVE)); + my $d = $self->{-ent} ? $self->{-ent}->{description} : undef; + defined($d) ? ($self->{'txt.description'} = $d) : + _get_txt_start($self, 'description', $fini); + + reap_live() until ($nohang || !keys(%LIVE)); # for non-manifest clone } sub parse_epochs ($$) { @@ -538,6 +543,8 @@ EOM return if $self->{lei}->{child_error}; my $task = bless { %$self }, __PACKAGE__; + $task->{-ent} = $m->{$name} // + die("BUG: no `$name' in manifest"); $task->{cur_src} = "$uri"; $task->{cur_dst} = $task->{dst}; if ($n > 1) {