]> Sergey Matveev's repositories - public-inbox.git/commitdiff
lei_mirror: avoid convoluted lazy_cb usage
authorEric Wong <e@80x24.org>
Mon, 28 Nov 2022 05:31:40 +0000 (05:31 +0000)
committerEric Wong <e@80x24.org>
Mon, 28 Nov 2022 23:38:56 +0000 (23:38 +0000)
lazy_cb should only be used for lei command dispatch and
completion callbacks when the method isn't known at startup.
There's zero reason to use it when the method is known
ahead-of-time, especially when there's a comment pointing
reviewers towards the only possible method it can dispatch.

lib/PublicInbox/LEI.pm
lib/PublicInbox/LeiMirror.pm

index f3e80113ed7042e7332fb307653825fbd8e3314f..8a14ace486bc9c0deee84cecc9684dfab488b060 100644 (file)
@@ -787,7 +787,7 @@ EOM
        }
 }
 
-sub lazy_cb ($$$) {
+sub lazy_cb ($$$) { # $pfx is _complete_ or lei_
        my ($self, $cmd, $pfx) = @_;
        my $ucmd = $cmd;
        $ucmd =~ tr/-/_/;
index 0df377244ba9afab728dfe4f1100ed7b17f02dfc..b27452956e235767c6a1a0a7f139eb94c44101bf 100644 (file)
@@ -31,9 +31,9 @@ sub _wq_done_wait { # dwaitpid callback (via wq_eof)
                warn("unlink($f): $!\n") unless $!{ENOENT};
        } else {
                if (!$mrr->{dry_run} && $lei->{cmd} ne 'public-inbox-clone') {
-                       # calls _finish_add_external
-                       $lei->lazy_cb('add-external', '_finish_'
-                                       )->($lei, $mrr->{dst});
+                       require PublicInbox::LeiAddExternal;
+                       PublicInbox::LeiAddExternal::_finish_add_external(
+                                                       $lei, $mrr->{dst});
                }
                $lei->qerr("# mirrored $mrr->{src} => $mrr->{dst}");
        }