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,BAYES_00 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 C37F41F9E5 for ; Sun, 2 May 2021 06:05:42 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 2/6] lei_input: common net_merge_all_done for lei Date: Sun, 2 May 2021 06:05:38 +0000 Message-Id: <20210502060542.11598-3-e@80x24.org> In-Reply-To: <20210502060542.11598-1-e@80x24.org> References: <20210502060542.11598-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: I suspect there'll be more lei_input-only things in the future. --- lib/PublicInbox/LeiImport.pm | 7 +------ lib/PublicInbox/LeiInput.pm | 7 +++++++ lib/PublicInbox/LeiTag.pm | 7 +------ 3 files changed, 9 insertions(+), 12 deletions(-) diff --git a/lib/PublicInbox/LeiImport.pm b/lib/PublicInbox/LeiImport.pm index 575cf125..394138b4 100644 --- a/lib/PublicInbox/LeiImport.pm +++ b/lib/PublicInbox/LeiImport.pm @@ -48,12 +48,6 @@ sub input_net_cb { # imap_each / nntp_each input_eml_cb($self, $eml, $vmd); } -sub net_merge_all_done { # callback used by LeiAuth - my ($self) = @_; - $self->wq_io_do('process_inputs'); - $self->wq_close(1); -} - sub lei_import { # the main "lei import" method my ($lei, @inputs) = @_; my $sto = $lei->_lei_store(1); @@ -99,6 +93,7 @@ sub _complete_import { no warnings 'once'; *ipc_atfork_child = \&PublicInbox::LeiInput::input_only_atfork_child; +*net_merge_all_done = \&PublicInbox::LeiInput::input_only_net_merge_all_done; # the following works even when LeiAuth is lazy-loaded *net_merge_all = \&PublicInbox::LeiAuth::net_merge_all; diff --git a/lib/PublicInbox/LeiInput.pm b/lib/PublicInbox/LeiInput.pm index 9bcc86e1..917f682b 100644 --- a/lib/PublicInbox/LeiInput.pm +++ b/lib/PublicInbox/LeiInput.pm @@ -329,6 +329,13 @@ sub input_only_atfork_child { undef; } +# alias this as "net_merge_all_done" to use as an LeiAuth callback +sub input_only_net_merge_all_done { + my ($self) = @_; + $self->wq_io_do('process_inputs'); + $self->wq_close(1); +} + # like Getopt::Long, but for +kw:FOO and -kw:FOO to prepare # for update_xvmd -> update_vmd sub vmd_mod_extract { diff --git a/lib/PublicInbox/LeiTag.pm b/lib/PublicInbox/LeiTag.pm index 2170e3f2..6025c93e 100644 --- a/lib/PublicInbox/LeiTag.pm +++ b/lib/PublicInbox/LeiTag.pm @@ -19,12 +19,6 @@ sub input_eml_cb { # used by PublicInbox::LeiInput::input_fh sub input_mbox_cb { input_eml_cb($_[1], $_[0]) } -sub net_merge_all_done { # callback used by LeiAuth - my ($self) = @_; - $self->wq_io_do('process_inputs'); - $self->wq_close(1); -} - sub input_maildir_cb { # maildir_each_eml cb my ($f, $kw, $eml, $self) = @_; input_eml_cb($self, $eml); @@ -117,5 +111,6 @@ sub _complete_tag { no warnings 'once'; # the following works even when LeiAuth is lazy-loaded *net_merge_all = \&PublicInbox::LeiAuth::net_merge_all; +*net_merge_all_done = \&PublicInbox::LeiInput::input_only_net_merge_all_done; 1;