This prevents multiple update processes from stepping over
each other while called under the lock, and also allows the
new -watch process to update the index iff indexing was
desired.
waitpid($pid, 0) == $pid or
die 'update-server-info did not finish';
$? == 0 or die "failed to update-server-info: $?\n";
+
+ eval {
+ require PublicInbox::SearchIdx;
+ PublicInbox::SearchIdx->new($git_dir, 2)->index_sync;
+ };
}
my $lockfh = delete $self->{lockfh} or die "BUG: not locked: $!";
$im->add($mime);
}
$im->done;
- eval {
- require PublicInbox::SearchIdx;
- PublicInbox::SearchIdx->new($git_dir, 2)->index_sync;
- };
}
if ($err) {
} # else { accept
PublicInbox::MDA->set_list_headers($mime, $dst);
-END { index_sync($main_repo) if $? == 0 };
my $git = PublicInbox::Git->new($main_repo);
my $im = PublicInbox::Import->new($git, $dst->{name}, $recipient);
if (defined $im->add($mime)) {
($? || $$out eq '') ? 0 : 1;
}
-
-sub index_sync {
- my ($git_dir) = @_;
- eval {
- require PublicInbox::SearchIdx;
- PublicInbox::SearchIdx->new($git_dir, 2)->index_sync;
- };
-}