$self->checkpoint;
$max = $self->git_epoch_max + 1;
}
+ my (undef, $tl) = eidx_init($self); # acquire lock
my $pfx = $self->git_pfx;
$max //= $self->git_epoch_max;
while (1) {
my $git = PublicInbox::Git->new($latest);
if (!$old) {
$git->qx(qw(config core.sharedRepository 0600));
- $self->done; # force eidx_init on next round
+ $self->done; # unlock
+ # re-acquire lock, update alternates for new epoch
+ (undef, $tl) = eidx_init($self);
}
my $packed_bytes = $git->packed_bytes;
my $unpacked_bytes = $packed_bytes / $self->packing_factor;
my $tl = wantarray && $self->{-err_wr} ?
PublicInbox::OnDestroy->new($$, \&_tail_err, $self) :
undef;
- $eidx->idx_init({-private => 1});
+ $eidx->idx_init({-private => 1}); # acquires lock
wantarray ? ($eidx, $tl) : $eidx;
}
\@docids;
}
-sub set_sync_info ($$$) {
- my ($self, $oidhex, $sync_info) = @_;
+sub set_sync_info {
+ my ($self, $oidhex, $folder, $id) = @_;
($self->{lms} //= do {
require PublicInbox::LeiMailSync;
my $f = "$self->{priv_eidx}->{topdir}/mail_sync.sqlite3";
my $lms = PublicInbox::LeiMailSync->new($f);
$lms->lms_begin;
$lms;
- })->set_src($oidhex, @$sync_info);
+ })->set_src($oidhex, $folder, $id);
}
sub add_eml {
my ($self, $eml, $vmd, $xoids) = @_;
my $im = $self->importer; # may create new epoch
- my ($eidx, $tl) = eidx_init($self); # updates/writes alternates file
+ my ($eidx, $tl) = eidx_init($self);
my $oidx = $eidx->{oidx}; # PublicInbox::Import::add checks this
my $smsg = bless { -oidx => $oidx }, 'PublicInbox::Smsg';
my $im_mark = $im->add($eml, undef, $smsg);
if ($vmd && $vmd->{sync_info}) {
- set_sync_info($self, $smsg->{blob}, $vmd->{sync_info});
+ set_sync_info($self, $smsg->{blob}, @{$vmd->{sync_info}});
}
$im_mark or return; # duplicate blob returns undef