From a8ab1ced5ad9efc4ca0b772e0f89c6a2c08229dd Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Wed, 17 Aug 2022 09:33:16 +0000 Subject: [PATCH] lei/store: reduce work when accessing mail_sync.sqlite3 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; }; } -- 2.48.1