diff options
author | Eric Wong <e@80x24.org> | 2021-09-22 02:24:33 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2021-09-22 05:21:22 +0000 |
commit | 5c86be0c56d7f250a91c061c00243546d81146ae (patch) | |
tree | edbc58fad041a104dd08ce0fb71bf5fe57ccb8e5 /lib/PublicInbox | |
parent | 1762d79d38eb2407ac94c1c2005430b81200dd46 (diff) | |
download | public-inbox-5c86be0c56d7f250a91c061c00243546d81146ae.tar.gz |
A few dozen bytes saved here can add up when we have thousands of inboxes. It also makes Data::Dumper debug output a bit cleaner.
Diffstat (limited to 'lib/PublicInbox')
-rw-r--r-- | lib/PublicInbox/Inbox.pm | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/PublicInbox/Inbox.pm b/lib/PublicInbox/Inbox.pm index 6cd20ec0..20f8c884 100644 --- a/lib/PublicInbox/Inbox.pm +++ b/lib/PublicInbox/Inbox.pm @@ -126,11 +126,12 @@ sub version { sub git_epoch { my ($self, $epoch) = @_; # v2-only, callers always supply $epoch - $self->{"$epoch.git"} ||= do { + $self->{"$epoch.git"} //= do { my $git_dir = "$self->{inboxdir}/git/$epoch.git"; return unless -d $git_dir; my $g = PublicInbox::Git->new($git_dir); - $g->{-httpbackend_limiter} = $self->{-httpbackend_limiter}; + my $lim = $self->{-httpbackend_limiter}; + $g->{-httpbackend_limiter} = $lim if $lim; # caller must manually cleanup when done $g; }; @@ -138,11 +139,12 @@ sub git_epoch { sub git { my ($self) = @_; - $self->{git} ||= do { + $self->{git} //= do { my $git_dir = $self->{inboxdir}; $git_dir .= '/all.git' if $self->version == 2; my $g = PublicInbox::Git->new($git_dir); - $g->{-httpbackend_limiter} = $self->{-httpbackend_limiter}; + my $lim = $self->{-httpbackend_limiter}; + $g->{-httpbackend_limiter} = $lim if $lim; _cleanup_later($self); $g; }; |