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 A64841F47C for ; Wed, 14 Aug 2024 00:16:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=80x24.org; s=selector1; t=1723594605; bh=bEWON5tGxTwtQ6Gk8DRl+9KZ5qpgTpiEFyovytj3yVg=; h=From:To:Subject:Date:In-Reply-To:References:From; b=rG3fahq/srHsi3aXF8adKofBzawnujfxhIpYu7FR062pDfb4JflpY1MsDEM0B+zSL xYM63Bk8sUFx6UQ7d68MMwQK8f8Sm1FCBZr1w7H8hNKvy5+mPNvM+dfdE5qxHM+nFW IHCS7pAE6x5mAkTZeAARRMc4Wdjtw7mw7I22+zDY= From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 1/5] git: rename `_active' sub to `cat_active' Date: Wed, 14 Aug 2024 00:16:41 +0000 Message-Id: <20240814001645.395576-2-e@80x24.org> In-Reply-To: <20240814001645.395576-1-e@80x24.org> References: <20240814001645.395576-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: Having an underscore prefix is confusing for a public subroutine, and the `cat_' prefix makes it obvious it isn't some other command. --- lib/PublicInbox/Git.pm | 6 +++--- lib/PublicInbox/LeiStore.pm | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/PublicInbox/Git.pm b/lib/PublicInbox/Git.pm index 32c11a59..dd0a14e9 100644 --- a/lib/PublicInbox/Git.pm +++ b/lib/PublicInbox/Git.pm @@ -457,7 +457,7 @@ sub date_parse { } $self->qx('rev-parse', map { "--since=$_" } @_); } -sub _active ($) { +sub cat_active ($) { scalar(@{gcf_inflight($_[0]) // []}) || ($_[0]->{ck} && scalar(@{gcf_inflight($_[0]->{ck}) // []})) } @@ -466,7 +466,7 @@ sub _active ($) { # both completely done by using this: sub async_wait_all ($) { my ($self) = @_; - while (_active($self)) { + while (cat_active($self)) { check_async_wait($self); cat_async_wait($self); } @@ -475,7 +475,7 @@ sub async_wait_all ($) { # returns true if there are pending "git cat-file" processes sub cleanup { my ($self, $lazy) = @_; - ($lazy && _active($self)) and + ($lazy && cat_active($self)) and return $self->{epwatch} ? watch_async($self) : 1; local $in_cleanup = 1; async_wait_all($self); diff --git a/lib/PublicInbox/LeiStore.pm b/lib/PublicInbox/LeiStore.pm index b2da2bc3..f9e8267b 100644 --- a/lib/PublicInbox/LeiStore.pm +++ b/lib/PublicInbox/LeiStore.pm @@ -573,7 +573,7 @@ sub set_xvmd { sub check_done { my ($self) = @_; - $self->git->_active ? + $self->git->cat_active ? add_uniq_timer("$self-check_done", 5, \&check_done, $self) : done($self); }