From 47d4e53734820b4e5a2f6cfa29056329e387ef22 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sat, 18 Sep 2021 09:33:25 +0000 Subject: lei_mail_sync: rely on flock(2), avoid IPC 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. --- lib/PublicInbox/LeiInspect.pm | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'lib/PublicInbox/LeiInspect.pm') diff --git a/lib/PublicInbox/LeiInspect.pm b/lib/PublicInbox/LeiInspect.pm index 2385f7f8..f06cea61 100644 --- a/lib/PublicInbox/LeiInspect.pm +++ b/lib/PublicInbox/LeiInspect.pm @@ -18,7 +18,7 @@ sub inspect_blob ($$) { my $oidbin = pack('H*', $oidhex); my @docids = $lse ? $lse->over->oidbin_exists($oidbin) : (); $ent->{'lei/store'} = \@docids if @docids; - my $lms = $lse->lms; + my $lms = $lei->lms; if (my $loc = $lms ? $lms->locations_for($oidbin) : undef) { $ent->{'mail-sync'} = $loc; } @@ -29,8 +29,7 @@ sub inspect_blob ($$) { sub inspect_imap_uid ($$) { my ($lei, $uid_uri) = @_; my $ent = {}; - my $lse = $lei->{lse} or return $ent; - my $lms = $lse->lms or return $ent; + my $lms = $lei->lms or return $ent; my $oidhex = $lms->imap_oid($lei, $uid_uri); if (ref(my $err = $oidhex)) { # art2folder error $lei->qerr(@{$err->{qerr}}) if $err->{qerr}; -- cgit v1.2.3-24-ge0c7