user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
From: Eric Wong <e@80x24.org>
To: meta@public-inbox.org
Subject: [PATCH 1/2] git: cleanup un-associated coderepo processes
Date: Thu, 26 Oct 2023 08:20:06 +0000	[thread overview]
Message-ID: <20231026082007.1313217-2-e@80x24.org> (raw)
In-Reply-To: <20231026082007.1313217-1-e@80x24.org>

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   | 6 ++++--
 lib/PublicInbox/Inbox.pm | 4 ----
 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;
 	};
 }

  reply	other threads:[~2023-10-26  8:20 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-26  8:20 [PATCH 0/2] unrelated coderepo-related fixes Eric Wong
2023-10-26  8:20 ` Eric Wong [this message]
2023-10-26  8:20 ` [PATCH 2/2] cindex: clarify fatal vs non-fatal messages Eric Wong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://public-inbox.org/README

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231026082007.1313217-2-e@80x24.org \
    --to=e@80x24.org \
    --cc=meta@public-inbox.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/public-inbox.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).