From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,AWL,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id A607D20192 for ; Mon, 28 Nov 2022 05:32:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=80x24.org; s=selector1; t=1669613561; bh=Ki2ZlSRYmjDSyWtITyIDAwKQIbCQb5lxY4T6/BXUrss=; h=From:To:Subject:Date:In-Reply-To:References:From; b=wDi+uBIbAO/EbD1/QTt13ymovRsFTUcgkTYO4cW+JdcCpignx52TEz6GKbdNsnrua rJrC38oSbPYn+5xb1Ijgokkwfa11dkJFuKz3gt9B1PHJ5SZJYG9jdEOAyZ+4RahsDA Ik8foOW3/Md0Hc7KdOlfp1tf66HDyimHjGyg6M3Q= From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 43/95] lei_mirror: avoid convoluted lazy_cb usage Date: Mon, 28 Nov 2022 05:31:40 +0000 Message-Id: <20221128053232.291618-44-e@80x24.org> In-Reply-To: <20221128053232.291618-1-e@80x24.org> References: <20221128053232.291618-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: 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 | 2 +- lib/PublicInbox/LeiMirror.pm | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/PublicInbox/LEI.pm b/lib/PublicInbox/LEI.pm index f3e80113..8a14ace4 100644 --- a/lib/PublicInbox/LEI.pm +++ b/lib/PublicInbox/LEI.pm @@ -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/-/_/; diff --git a/lib/PublicInbox/LeiMirror.pm b/lib/PublicInbox/LeiMirror.pm index 0df37724..b2745295 100644 --- a/lib/PublicInbox/LeiMirror.pm +++ b/lib/PublicInbox/LeiMirror.pm @@ -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}"); }