about summary refs log tree commit homepage
path: root/lib/PublicInbox/Inbox.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/PublicInbox/Inbox.pm')
-rw-r--r--lib/PublicInbox/Inbox.pm11
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/PublicInbox/Inbox.pm b/lib/PublicInbox/Inbox.pm
index 20f8c884..02ffc7be 100644
--- a/lib/PublicInbox/Inbox.pm
+++ b/lib/PublicInbox/Inbox.pm
@@ -22,8 +22,15 @@ my $CLEANUP = {}; # string(inbox) -> inbox
 
 sub git_cleanup ($) {
         my ($self) = @_;
-        my $git = $self->{git} or return;
-        $git->cleanup;
+        if ($self->isa(__PACKAGE__)) {
+                # normal Inbox; low startup cost, and likely to have many
+                # many so this keeps process/pipe counts in check
+                $self->{git}->cleanup if $self->{git};
+        } else {
+                # ExtSearch, high startup cost if ->ALL, and probably
+                # only one per-daemon, so teardown only if required:
+                $self->git->cleanup_if_unlinked;
+        }
 }
 
 sub cleanup_task () {