]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/LeiMirror.pm
ipc+lei: switch to awaitpid
[public-inbox.git] / lib / PublicInbox / LeiMirror.pm
index db249eceff64bc759b619ddb4f9c5e6a9cf1f180..abf663159855e3818f1e484d6d7ffe7060680102 100644 (file)
@@ -31,9 +31,8 @@ sub keep_going ($) {
                $_[0]->{lei}->{opt}->{'keep-going'});
 }
 
-sub _wq_done_wait { # dwaitpid callback (via wq_eof)
-       my ($arg, $pid) = @_;
-       my ($mrr, $lei) = @$arg;
+sub _wq_done_wait { # awaitpid cb (via wq_eof / IPC->awaitpid_init)
+       my ($pid, $mrr, $lei) = @_;
        if ($?) {
                $lei->child_error($?);
        } elsif (!$lei->{child_error}) {
@@ -236,7 +235,7 @@ sub index_cloned_inbox {
                        my ($k) = ($sw =~ /\A([\w-]+)/);
                        $opt->{$k} = $lei->{opt}->{$k};
                }
-               # force synchronous dwaitpid for v2:
+               # force synchronous awaitpid for v2:
                local $PublicInbox::DS::in_loop = 0;
                my $cfg = PublicInbox::Config->new(undef, $lei->{2});
                my $env = PublicInbox::Admin::index_prepare($opt, $cfg);
@@ -1056,7 +1055,8 @@ EOM
 
        my (undef, $dn, $bn) = File::Spec->splitpath($f);
        $self->{chg}->{nr_chg} += scalar(@remote) + scalar(@local);
-       atomic_write($dn, $bn, join("\n", @list, ''));
+       my $new = join("\n", @list, '');
+       atomic_write($dn, $bn, $new) if $new ne $old;
 }
 
 # FIXME: this gets confused by single inbox instance w/ global manifest.js.gz