about summary refs log tree commit homepage
path: root/lib/PublicInbox/Git.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2021-10-01 09:54:43 +0000
committerEric Wong <e@80x24.org>2021-10-01 12:06:33 +0000
commit770604494e1054ada8d9e3960e4a6c7e82a09ad5 (patch)
tree687ad2cd4f7ec416c411edfed61e8f466e2bf9df /lib/PublicInbox/Git.pm
parent0fa6324e2f45a93dbfca57989ca115b13048133f (diff)
downloadpublic-inbox-770604494e1054ada8d9e3960e4a6c7e82a09ad5.tar.gz
Having git processes outlive DB handles is likely to hurt
from a fragmentation perspective if the DB handle needs to
be recreated immediately due to a git->cat_async callback.
So only unref DB handles when we're sure there's no live
git users left, otherwise check the inodes.

We'll also avoid needless localization checks in git->cleanup
and make the return value more obvious since the pid fields are
unconditionally deleted nowadays.
Diffstat (limited to 'lib/PublicInbox/Git.pm')
-rw-r--r--lib/PublicInbox/Git.pm4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/PublicInbox/Git.pm b/lib/PublicInbox/Git.pm
index 97c39aad..77783000 100644
--- a/lib/PublicInbox/Git.pm
+++ b/lib/PublicInbox/Git.pm
@@ -399,16 +399,16 @@ sub async_wait_all ($) {
 # returns true if there are pending "git cat-file" processes
 sub cleanup {
         my ($self, $lazy) = @_;
-        local $in_cleanup = 1;
         return 1 if $lazy && (scalar(@{$self->{inflight_c} // []}) ||
                                 scalar(@{$self->{inflight} // []}));
+        local $in_cleanup = 1;
         delete $self->{async_cat};
         async_wait_all($self);
         delete $self->{inflight};
         delete $self->{inflight_c};
         _destroy($self, qw(cat_rbuf in out pid));
         _destroy($self, qw(chk_rbuf in_c out_c pid_c err_c));
-        defined($self->{pid}) || defined($self->{pid_c});
+        undef;
 }
 
 # assuming a well-maintained repo, this should be a somewhat