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-ASN: X-Spam-Status: No, score=-4.2 required=3.0 tests=ALL_TRUSTED,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.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 144651F619 for ; Wed, 17 Aug 2022 09:33:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=80x24.org; s=selector1; t=1660728798; bh=Z6ljfYqrE5pg0gH/HkkUKXA7s/CjVNeE4lmMlh6/Ey8=; h=From:To:Subject:Date:In-Reply-To:References:From; b=JDDXaOXrrjoWzJpO/BHq/UdvT3yXijZ3In2PrEgYGZNKd7qWmkjkow05rAlrO39X2 dvcfxYYYtpAExjug88ewOlpAsN/Z5fIqW8f4JBWgxhoaMdbs1ic3njMPCrYR31wB5o vb4ZIs0R/tApJNrY1cgKQ5tIw6fqrOYIdm3QKGss= From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 3/4] lei/store: reduce work when accessing mail_sync.sqlite3 Date: Wed, 17 Aug 2022 09:33:16 +0000 Message-Id: <20220817093317.3820774-4-e@80x24.org> In-Reply-To: <20220817093317.3820774-1-e@80x24.org> References: <20220817093317.3820774-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: There's no need to initialize eidx if we already have an open handle for mail_sync.sqlite3 --- lib/PublicInbox/LeiStore.pm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/PublicInbox/LeiStore.pm b/lib/PublicInbox/LeiStore.pm index 66049dfe..d49746cb 100644 --- a/lib/PublicInbox/LeiStore.pm +++ b/lib/PublicInbox/LeiStore.pm @@ -255,13 +255,13 @@ sub remove_eml_vmd { # remove just the VMD sub _lms_rw ($) { # it is important to have eidx processes open before lms my ($self) = @_; - my ($eidx, $tl) = eidx_init($self); - $self->{lms} //= do { + $self->{lms} // do { require PublicInbox::LeiMailSync; + my ($eidx, $tl) = eidx_init($self); my $f = "$self->{priv_eidx}->{topdir}/mail_sync.sqlite3"; my $lms = PublicInbox::LeiMailSync->new($f); $lms->lms_write_prepare; - $lms; + $self->{lms} = $lms; }; }