From 6b3ba59d4bfdf20507fd890df6ff1454a93435e4 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Wed, 21 Apr 2021 18:36:10 +0000 Subject: lei: share common *done_wait callbacks Code is the enemy, and there's no need to duplicate things, here. There may be further opportunities along these lines to further deduplicate things... --- lib/PublicInbox/LeiImport.pm | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) (limited to 'lib/PublicInbox/LeiImport.pm') diff --git a/lib/PublicInbox/LeiImport.pm b/lib/PublicInbox/LeiImport.pm index d33143ef..16271603 100644 --- a/lib/PublicInbox/LeiImport.pm +++ b/lib/PublicInbox/LeiImport.pm @@ -35,17 +35,10 @@ sub input_net_cb { # imap_each, nntp_each cb input_eml_cb($self, $eml, $self->{-import_kw} ? { kw => $kw } : undef); } -sub import_done_wait { # dwaitpid callback - my ($arg, $pid) = @_; - my ($imp, $lei) = @$arg; - $lei->child_error($?, 'non-fatal errors during import') if $?; - $lei->dclose; -} - sub import_done { # EOF callback for main daemon my ($lei) = @_; my $imp = delete $lei->{imp} // return $lei->fail('BUG: {imp} gone'); - $imp->wq_wait_old(\&import_done_wait, $lei); + $imp->wq_wait_old($lei->can('wq_done_wait'), $lei, 'non-fatal'); } sub net_merge_complete { # callback used by LeiAuth -- cgit v1.2.3-24-ge0c7