diff options
author | Eric Wong <e@80x24.org> | 2021-09-18 09:33:25 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2021-09-18 20:25:27 +0000 |
commit | 47d4e53734820b4e5a2f6cfa29056329e387ef22 (patch) | |
tree | 78328c0d68e3e329fa8c57c3300f8273bc122b89 /lib/PublicInbox/LeiImport.pm | |
parent | 7b7939d47b336fb7d8c4387858e620dbc218bb1e (diff) | |
download | public-inbox-47d4e53734820b4e5a2f6cfa29056329e387ef22.tar.gz |
Since 44917fdd24a8bec1 ("lei_mail_sync: do not use transactions"), relying on lei/store to serialize access was a pointless endeavor. Rely on flock(2) to serialize multiple writers since (in my experience) it's the easiest way to deal with parallel writers when using SQLite. This allows us to simplify existing callers while speeding up 'lei refresh-mail-sync --all=local' by 5% or so.
Diffstat (limited to 'lib/PublicInbox/LeiImport.pm')
-rw-r--r-- | lib/PublicInbox/LeiImport.pm | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/PublicInbox/LeiImport.pm b/lib/PublicInbox/LeiImport.pm index b1cb3940..9084d771 100644 --- a/lib/PublicInbox/LeiImport.pm +++ b/lib/PublicInbox/LeiImport.pm @@ -36,7 +36,7 @@ sub pmdir_cb { # called via wq_io_do from LeiPmdir->each_mdir_fn my $kw = PublicInbox::MdirReader::flags2kw($fl); substr($folder, 0, 0) = 'maildir:'; # add prefix my $lse = $self->{lse} //= $self->{lei}->{sto}->search; - my $lms = $self->{-lms_ro} //= $lse->lms; # may be 0 or undef + my $lms = $self->{-lms_ro} //= $self->{lei}->lms; # may be 0 or undef my $oidbin = $lms ? $lms->name_oidbin($folder, $bn) : undef; my @docids = defined($oidbin) ? $lse->over->oidbin_exists($oidbin) : (); my $vmd = $self->{-import_kw} ? { kw => $kw } : undef; @@ -83,7 +83,7 @@ sub do_import_index ($$@) { # $j = $net->net_concurrency($j); TODO if ($lei->{opt}->{incremental} // 1) { $net->{incremental} = 1; - $net->{-lms_ro} = $sto->search->lms // 0; + $net->{-lms_ro} = $lei->lms // 0; if ($self->{-import_kw} && $net->{-lms_ro} && !$lei->{opt}->{'new-only'} && $net->{imap_order}) { @@ -120,8 +120,7 @@ sub _complete_import { my $match_cb = $lei->complete_url_prepare(\@argv); my @m = map { $match_cb->($_) } $lei->url_folder_cache->keys; my %f = map { $_ => 1 } @m; - my $sto = $lei->_lei_store; - if (my $lms = $sto ? $sto->search->lms : undef) { + if (my $lms = $lei->lms) { @m = map { $match_cb->($_) } $lms->folders; @f{@m} = @m; } |