diff options
author | Eric Wong <e@80x24.org> | 2023-11-02 09:35:38 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2023-11-03 06:39:44 +0000 |
commit | 8d86e5b49d7f5d6e0b1768d0bd55fd21df36f86e (patch) | |
tree | 74c292ea35d4963525327cc5f7e64dc975156fee /lib/PublicInbox/LeiMirror.pm | |
parent | 3aa444b4c4eef1c40a49e5db191eb844c6624b58 (diff) | |
download | public-inbox-8d86e5b49d7f5d6e0b1768d0bd55fd21df36f86e.tar.gz |
The IO package seems like a better home for I/O subs than the Git package. We lose the 60 second read timeout for `git cat-file --batch-*' processes since it's probably not necessary given how reliable the code has proven and things would fall over hard in other ways if the storage device were completely hosed.
Diffstat (limited to 'lib/PublicInbox/LeiMirror.pm')
-rw-r--r-- | lib/PublicInbox/LeiMirror.pm | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/lib/PublicInbox/LeiMirror.pm b/lib/PublicInbox/LeiMirror.pm index e4914f75..49febe9e 100644 --- a/lib/PublicInbox/LeiMirror.pm +++ b/lib/PublicInbox/LeiMirror.pm @@ -17,7 +17,6 @@ use Carp qw(croak); use URI; use PublicInbox::Config qw(glob2re); use PublicInbox::Inbox; -use PublicInbox::Git qw(read_all); use PublicInbox::LeiCurl; use PublicInbox::OnDestroy; use PublicInbox::SHA qw(sha256_hex sha_all); @@ -174,7 +173,7 @@ sub _get_txt_done { # returns true on error (non-fatal), undef on success return warn("# @$cmd failed (non-fatal)\n") if $cerr; seek($fh, 0, SEEK_SET); $self->{"mtime.$endpoint"} = (stat($fh))[9]; - $self->{"txt.$endpoint"} = read_all($fh, -s _); + $self->{"txt.$endpoint"} = PublicInbox::IO::read_all $fh, -s _; undef; # success } @@ -207,7 +206,7 @@ sub _write_inbox_config { sub set_description ($) { my ($self) = @_; my $dst = $self->{cur_dst} // $self->{dst}; - chomp(my $orig = PublicInbox::Git::try_cat("$dst/description")); + chomp(my $orig = PublicInbox::IO::try_cat("$dst/description")); my $d = $orig; while (defined($d) && ($d =~ m!^\(\$INBOX_DIR/description missing\)! || $d =~ /^Unnamed repository/ || $d !~ /\S/)) { @@ -806,7 +805,7 @@ sub update_ent { } if (defined(my $t = $self->{-ent}->{modified})) { my ($dn, $bn) = ("$dst/info/web", 'last-modified'); - my $orig = PublicInbox::Git::try_cat("$dn/$bn"); + my $orig = PublicInbox::IO::try_cat("$dn/$bn"); $t = strftime('%F %T', gmtime($t))." +0000\n"; File::Path::mkpath($dn); atomic_write($dn, $bn, $t) if $orig ne $t; @@ -936,7 +935,7 @@ failed to extract epoch number from $src sub decode_manifest ($$$) { my ($fh, $fn, $uri) = @_; my $js; - my $gz = read_all($fh); + my $gz = PublicInbox::IO::read_all $fh; gunzip(\$gz => \$js, MultiStream => 1) or die "gunzip($uri): $GunzipError\n"; my $m = eval { PublicInbox::Config->json->decode($js) }; @@ -1083,7 +1082,7 @@ sub dump_manifest ($$) { sub dump_project_list ($$) { my ($self, $m) = @_; my $f = $self->{'-project-list'}; - my $old = defined($f) ? PublicInbox::Git::try_cat($f) : ''; + my $old = defined($f) ? PublicInbox::IO::try_cat($f) : ''; my %new; open my $dh, '<', '.'; |