From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.2 required=3.0 tests=ALL_TRUSTED,AWL,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, T_SCC_BODY_TEXT_LINE shortcircuit=no autolearn=ham autolearn_force=no version=3.4.6 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id AD92F1F513 for ; Tue, 28 Nov 2023 14:56:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=80x24.org; s=selector1; t=1701183388; bh=9vSHPefKAgRHr8JSNqwp3IIsWEB6ki3i+r8BBnYw2b4=; h=From:To:Subject:Date:In-Reply-To:References:From; b=Bbu5omUoXRUPs5/YOl7HLG3UXxUt8eWwEKox21B/ck9tgUpaW7VHIij6+neKoqezS rE20TJNUwYDBR/e5zmEB2gkxvVutJM3Z1onYGt7G6Fdwrr4jRoLhtF8UsDwLq6JGPr gMp2w8EbjA9Wie1uj0uRTJZk+MEUCwxhoi5eu75o= From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 04/14] solver: schedule cleanup after synchronous git->check Date: Tue, 28 Nov 2023 14:56:17 +0000 Message-ID: <20231128145628.1455176-5-e@80x24.org> In-Reply-To: <20231128145628.1455176-1-e@80x24.org> References: <20231128145628.1455176-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: We don't want hundreds of git cat-file processes for coderepos lingering around. --- lib/PublicInbox/Git.pm | 7 ++++++- lib/PublicInbox/SolverGit.pm | 3 +++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/PublicInbox/Git.pm b/lib/PublicInbox/Git.pm index fe834210..7c6e15b7 100644 --- a/lib/PublicInbox/Git.pm +++ b/lib/PublicInbox/Git.pm @@ -628,10 +628,15 @@ sub event_step { } } +sub schedule_cleanup { + my ($self) = @_; + PublicInbox::DS::add_uniq_timer($self+0, 30, \&cleanup, $self, 1); +} + # idempotently registers with DS epoll/kqueue/select/poll sub watch_async ($) { my ($self) = @_; - PublicInbox::DS::add_uniq_timer($self+0, 30, \&cleanup, $self, 1); + schedule_cleanup($self); $self->{epwatch} //= do { $self->SUPER::new($self->{sock}, EPOLLIN); \undef; diff --git a/lib/PublicInbox/SolverGit.pm b/lib/PublicInbox/SolverGit.pm index ba3c94cb..7cc10198 100644 --- a/lib/PublicInbox/SolverGit.pm +++ b/lib/PublicInbox/SolverGit.pm @@ -82,7 +82,10 @@ sub solve_existing ($$) { my $try = $want->{try_gits} //= [ @{$self->{gits}} ]; # array copy my $git = shift @$try or die 'BUG {try_gits} empty'; my $oid_b = $want->{oid_b}; + + # can't use async_check due to last_check_err :< my ($oid_full, $type, $size) = $git->check($oid_b); + $git->schedule_cleanup if $self->{psgi_env}->{'pi-httpd.async'}; if ($oid_b eq ($oid_full // '') || (defined($type) && (!$self->{have_hints} || $type eq 'blob'))) {