]> git.ipfire.org Git - thirdparty/public-inbox.git/commitdiff
git: cleanup un-associated coderepo processes
authorEric Wong <e@80x24.org>
Thu, 26 Oct 2023 08:20:06 +0000 (08:20 +0000)
committerEric Wong <e@80x24.org>
Thu, 26 Oct 2023 17:51:49 +0000 (17:51 +0000)
It's possible to have many coderepos with no inbox association
that never see git->cleanup.  So instead of tying git->cleanup
to inboxes, ensure it gets armed when ->watch_async is called
(since it's only called in our -netd or -httpd servers).

lib/PublicInbox/Git.pm
lib/PublicInbox/Inbox.pm

index 9c26d8bfb400bf0b8f23f359d36e4168b70676eb..f4a24f2a3c39ddac260bc1a1b7486e9b56d86b16 100644 (file)
@@ -668,8 +668,10 @@ sub event_step {
 
 # idempotently registers with DS epoll/kqueue/select/poll
 sub watch_async ($) {
-       $_[0]->{epwatch} //= do {
-               $_[0]->SUPER::new($_[0]->{sock}, EPOLLIN);
+       my ($self) = @_;
+       PublicInbox::DS::add_uniq_timer($self+0, 30, \&cleanup, $self, 1);
+       $self->{epwatch} //= do {
+               $self->SUPER::new($self->{sock}, EPOLLIN);
                \undef;
        }
 }
index 3dad700438ad9dbaa5b1189296bd5ef796b64fd2..b31f3fff71b470ad883091aaa60c2a09ffe9fca0 100644 (file)
@@ -33,9 +33,6 @@ sub do_cleanup {
        }
        my $srch = $ibx->{search} // $ibx;
        delete @$srch{qw(xdb qp)};
-       for my $git (@{$ibx->{-repo_objs} // []}) {
-               $live = 1 if $git->cleanup(1);
-       }
        PublicInbox::DS::add_uniq_timer($ibx+0, 5, \&do_cleanup, $ibx) if $live;
 }
 
@@ -116,7 +113,6 @@ sub git {
                my $g = PublicInbox::Git->new($git_dir);
                my $lim = $self->{-httpbackend_limiter};
                $g->{-httpbackend_limiter} = $lim if $lim;
-               _cleanup_later($self);
                $g;
        };
 }