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 DE5B01F725 for ; Tue, 28 Nov 2023 14:56:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=80x24.org; s=selector1; t=1701183389; bh=lq+dsbKjtdmS5oteFn9eQzel8t2AvCALuno6Uy6+rnY=; h=From:To:Subject:Date:In-Reply-To:References:From; b=Je6bKw2w7gAo8j577PUdVg+/zGlUimROGjlM/Obfovg2A+rudfUA1MzxJ2ajrnWLE iW6O/JsKRGY90Yq5b3LXnspSAFjaqN7VShabmu0gAfngLmduBKmoRFwyeQJUYwX5+y 8yj0nT8eVGElxy1tylCUIr0yziyCbwyesa15P570= From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 13/14] cindex: extra quit checks Date: Tue, 28 Nov 2023 14:56:26 +0000 Message-ID: <20231128145628.1455176-14-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 to be accessing uninitialized variables on process teardown since much of our control flow revolves around DESTROY for dependency handling. --- lib/PublicInbox/CodeSearchIdx.pm | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/PublicInbox/CodeSearchIdx.pm b/lib/PublicInbox/CodeSearchIdx.pm index d49e9a8d..7d696099 100644 --- a/lib/PublicInbox/CodeSearchIdx.pm +++ b/lib/PublicInbox/CodeSearchIdx.pm @@ -338,6 +338,9 @@ sub shard_done { # called via PktOp on shard_index completion sub repo_stored { my ($self, $repo_ctx, $drs, $did) = @_; + # check @IDX_SHARDS instead of DO_QUIT to avoid wasting prior work + # because shard_commit is fast + return unless @IDX_SHARDS; $did > 0 or die "BUG: $repo_ctx->{repo}->{git_dir}: docid=$did"; my ($c, $p) = PublicInbox::PktOp->pair; $c->{ops}->{shard_done} = [ $self, $repo_ctx, @@ -509,6 +512,7 @@ sub shard_commit { # via wq_io_do sub dump_roots_start { my ($self, $do_join) = @_; + return if $DO_QUIT; $XHC //= PublicInbox::XapClient::start_helper("-j$NPROC"); $do_join // die 'BUG: no $do_join'; progress($self, 'dumping IDs from coderepos'); @@ -562,6 +566,7 @@ EOM sub dump_ibx_start { my ($self, $do_join) = @_; + return if $DO_QUIT; $XHC //= PublicInbox::XapClient::start_helper("-j$NPROC"); my ($sort_opt, $fold_opt); pipe(local $sort_opt->{0}, $DUMP_IBX_WPIPE);