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 630EB1F487 for ; Tue, 25 Apr 2023 11:02:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=80x24.org; s=selector1; t=1682420579; bh=x+RLRzgNUQN4CrWC9hVDJnnqyfqs//ZSmwqrQ3ytmHQ=; h=From:To:Subject:Date:In-Reply-To:References:From; b=HnsL4G9eRQ7rUG/qUC90UnZlL855UWLhw5YWY5jjoRKfDvqrYYEN674D06E6kgQTA ZTliuYIR4WBx+e6rNFPe/FOJMF3kKn1C5bu8WYEvDTmHsUM8ZG5Lhwevzi0fFskM0f HsuMWsuo8tUkjWVtp2m6WfhwkRinpgjqvsIpGUSk= From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 4/6] searchidxshard: use BUG error messages more consistently Date: Tue, 25 Apr 2023 11:02:56 +0000 Message-Id: <20230425110258.2538658-5-e@80x24.org> In-Reply-To: <20230425110258.2538658-1-e@80x24.org> References: <20230425110258.2538658-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: We'll also drop the "\n" for die() to make diagnostics easier. There's no known bugs in this area, just consistency improvements and LoC reduction. --- lib/PublicInbox/SearchIdxShard.pm | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/PublicInbox/SearchIdxShard.pm b/lib/PublicInbox/SearchIdxShard.pm index 831be51b..21bd56c2 100644 --- a/lib/PublicInbox/SearchIdxShard.pm +++ b/lib/PublicInbox/SearchIdxShard.pm @@ -32,12 +32,10 @@ sub new { $self; } -sub _worker_done { +sub _worker_done { # OnDestroy cb my ($self) = @_; - if ($self->need_xapian) { - die "$$ $0 xdb not released\n" if $self->{xdb}; - } - die "$$ $0 still in transaction\n" if $self->{txn}; + die "BUG: $$ $0 xdb active" if $self->need_xapian && $self->{xdb}; + die "BUG: $$ $0 txn active" if $self->{txn}; } sub ipc_atfork_child { # called automatically before ipc_worker_loop @@ -64,7 +62,7 @@ sub echo { sub idx_close { my ($self) = @_; - die "transaction in progress $self\n" if $self->{txn}; + die "BUG: $$ $0 txn active" if $self->{txn}; $self->idx_release if $self->{xdb}; }