about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2023-10-26 08:20:06 +0000
committerEric Wong <e@80x24.org>2023-10-26 17:51:49 +0000
commit33e99002c552e38d2207c97c9bae36c756f2546c (patch)
treed2c2e5729080caf9e0998188244b9993ed44fade
parentf4bb8e4e497785665b1a69c08c2325c5566c24f5 (diff)
downloadpublic-inbox-33e99002c552e38d2207c97c9bae36c756f2546c.tar.gz
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).
-rw-r--r--lib/PublicInbox/Git.pm6
-rw-r--r--lib/PublicInbox/Inbox.pm4
2 files changed, 4 insertions, 6 deletions
diff --git a/lib/PublicInbox/Git.pm b/lib/PublicInbox/Git.pm
index 9c26d8bf..f4a24f2a 100644
--- a/lib/PublicInbox/Git.pm
+++ b/lib/PublicInbox/Git.pm
@@ -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;
         }
 }
diff --git a/lib/PublicInbox/Inbox.pm b/lib/PublicInbox/Inbox.pm
index 3dad7004..b31f3fff 100644
--- a/lib/PublicInbox/Inbox.pm
+++ b/lib/PublicInbox/Inbox.pm
@@ -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;
         };
 }