From 42fd24099577e0f6b6ed58d95d11bdbd80721571 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sun, 2 May 2021 06:05:38 +0000 Subject: [PATCH 1/1] lei_input: common net_merge_all_done for lei 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; -- 2.44.0