From: Eric Wong Date: Mon, 28 Nov 2022 05:31:11 +0000 (+0000) Subject: lei_mirror: elide description retrieval for v1|coderepo X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=226ec7b0b3b69193bbd9e6b187fa9f11bfa43328;hp=26e1b36ce403e9ead26407987a8f3a50ff2ed77c;p=public-inbox.git lei_mirror: elide description retrieval for v1|coderepo manifest.js.gz can provide the description without an extra HTTP(S) requests, so attempt to use it whenever we're using the manifest. --- 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) {