]> Sergey Matveev's repositories - public-inbox.git/commitdiff
lei_input: common net_merge_all_done for lei <import|tag>
authorEric Wong <e@80x24.org>
Sun, 2 May 2021 06:05:38 +0000 (06:05 +0000)
committerEric Wong <e@80x24.org>
Mon, 3 May 2021 18:45:25 +0000 (18:45 +0000)
I suspect there'll be more lei_input-only things in the future.

lib/PublicInbox/LeiImport.pm
lib/PublicInbox/LeiInput.pm
lib/PublicInbox/LeiTag.pm

index 575cf125803cd63dbc4a048535d0184334550782..394138b49c41be27af34fe9078aca180be5805f4 100644 (file)
@@ -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;
index 9bcc86e1cacf77c1b18f0302fc2b788bbd4123bc..917f682ba97961c2d35e20935d0e8b69926fd1f9 100644 (file)
@@ -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 {
index 2170e3f2e7de196723715f7f322fdab75aaa4d13..6025c93e0b94675e65bed876c688425b42f84eb2 100644 (file)
@@ -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;