}
}
+# commit every 5s to get under the default DBD::SQLite timeout of 30s
+sub _schedule_checkpoint ($) {
+ my ($self) = @_;
+ add_uniq_timer("$self-checkpoint", 5, \&_commit, $self, 'barrier');
+}
+
# vmd = { kw => [ qw(seen ...) ], L => [ qw(inbox ...) ] }
sub set_eml_vmd {
my ($self, $eml, $vmd, $docids) = @_;
$eidx->idx_shard($docid)->ipc_do('set_vmd', $docid, $vmd);
sto_export_kw($self, $docid, $vmd);
}
+ _schedule_checkpoint $self;
$docids;
}
for my $docid (@docids) {
$eidx->idx_shard($docid)->ipc_do('add_vmd', $docid, $vmd);
}
+ _schedule_checkpoint $self;
\@docids;
}
for my $docid (@docids) {
$eidx->idx_shard($docid)->ipc_do('remove_vmd', $docid, $vmd);
}
+ _schedule_checkpoint $self;
\@docids;
}
}
$git->async_wait_all;
remove_docids($self, @docids);
+ _schedule_checkpoint $self;
\@docids;
}
sub _docids_and_maybe_kw ($$) {
my ($self, $docids) = @_;
+ _schedule_checkpoint $self;
return $docids unless wantarray;
my (@kw, $idx, @tmp);
for my $num (@$docids) { # likely only 1, unless ContentHash changes
} else {
warn("E: $type $hex\n");
}
+ _schedule_checkpoint $self;
}
sub reindex_art {
my $idx = $eidx->idx_shard($smsg->{num});
$idx->index_eml($eml, $smsg);
_add_vmd($self, $idx, $smsg->{num}, $vmd) if $vmd;
+ _schedule_checkpoint $self;
wantarray ? ($smsg, []) : $smsg;
}
}
my ($eidx, $tl) = eidx_init($self);
my $oidx = $eidx->{oidx};
my %seen;
+ _schedule_checkpoint $self;
for my $oid (keys %$xoids) {
my $docid = oid2docid($self, $oid) // next;
delete $xoids->{$oid};
my $oidx = $eidx->{oidx};
my %seen;
+ _schedule_checkpoint $self;
+
# see if we can just update existing docs
for my $oid (keys %$xoids) {
my $docid = oid2docid($self, $oid) // next;