From: Eric Wong Date: Tue, 25 Apr 2023 11:02:56 +0000 (+0000) Subject: searchidxshard: use BUG error messages more consistently X-Git-Tag: v2.0.0~1169 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=8ff2c6532a6e01ee11c3fa06be82f4aad27c18bf;p=thirdparty%2Fpublic-inbox.git searchidxshard: use BUG error messages more consistently 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. --- diff --git a/lib/PublicInbox/SearchIdxShard.pm b/lib/PublicInbox/SearchIdxShard.pm index 831be51b8..21bd56c27 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}; }