From: Eric Wong Date: Wed, 17 Aug 2022 09:33:16 +0000 (+0000) Subject: lei/store: reduce work when accessing mail_sync.sqlite3 X-Git-Tag: v1.9.0~12 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=a8ab1ced5ad9efc4ca0b772e0f89c6a2c08229dd;p=public-inbox.git 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 --- 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; }; }