]> Sergey Matveev's repositories - public-inbox.git/commitdiff
lei/store: reduce work when accessing mail_sync.sqlite3
authorEric Wong <e@80x24.org>
Wed, 17 Aug 2022 09:33:16 +0000 (09:33 +0000)
committerEric Wong <e@80x24.org>
Thu, 18 Aug 2022 07:21:48 +0000 (07:21 +0000)
There's no need to initialize eidx if we already have an open
handle for mail_sync.sqlite3

lib/PublicInbox/LeiStore.pm

index 66049dfeac84c0cb36cd124b331c85a36395b965..d49746cba34f2e9c4ccb1886e2a0447616c58cf4 100644 (file)
@@ -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;
        };
 }