From 5c86be0c56d7f250a91c061c00243546d81146ae Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Wed, 22 Sep 2021 02:24:33 +0000 Subject: inbox: do not waste hash slot on httpbackend_limiter 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. --- lib/PublicInbox/Inbox.pm | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'lib/PublicInbox') 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; }; -- cgit v1.2.3-24-ge0c7