From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 7B71A1FB05 for ; Wed, 23 Dec 2020 08:38:54 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 06/10] extsearchidx: close SQLite handles after attaching Date: Wed, 23 Dec 2020 08:38:49 +0000 Message-Id: <20201223083853.30721-7-e@80x24.org> In-Reply-To: <20201223083853.30721-1-e@80x24.org> References: <20201223083853.30721-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: This is needed to prevent us from running out of FDs when indexing many inboxes. Perhaps checking these on attach_inbox is unnecessary and may be removed entirely down the line. --- lib/PublicInbox/ExtSearchIdx.pm | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/PublicInbox/ExtSearchIdx.pm b/lib/PublicInbox/ExtSearchIdx.pm index 9d64ff5a..fb627089 100644 --- a/lib/PublicInbox/ExtSearchIdx.pm +++ b/lib/PublicInbox/ExtSearchIdx.pm @@ -65,11 +65,14 @@ sub attach_inbox { my $misc = $self->{misc}; if ($misc && $misc->inbox_data($ibx)) { # all good if already indexed } else { - if (!$ibx->over || !$ibx->mm) { + my @sqlite = ($ibx->over, $ibx->mm); + my $uidvalidity = $ibx->uidvalidity; + $ibx->{mm} = $ibx->{over} = undef; + if (scalar(@sqlite) != 2) { warn "W: skipping $ekey (unindexed)\n"; return; } - if (!defined($ibx->uidvalidity)) { + if (!defined($uidvalidity)) { warn "W: skipping $ekey (no UIDVALIDITY)\n"; return; }