X-Git-Url: http://www.git.stargrave.org/?a=blobdiff_plain;f=lib%2FPublicInbox%2FLeiImport.pm;h=21af28a3a79c647df2cf0b6dafa07d7e401e7efb;hb=5be0cb101bab44167a78af7a2d167f254c95bdb3;hp=767cae6028aa749545a6ccb37eb24f3d47f89799;hpb=60e5bddd086a8a90d5eaff32bc5c2026fc784ca0;p=public-inbox.git diff --git a/lib/PublicInbox/LeiImport.pm b/lib/PublicInbox/LeiImport.pm index 767cae60..21af28a3 100644 --- a/lib/PublicInbox/LeiImport.pm +++ b/lib/PublicInbox/LeiImport.pm @@ -10,19 +10,19 @@ use PublicInbox::Eml; use PublicInbox::PktOp qw(pkt_do); sub eml_cb { # used by PublicInbox::LeiInput::input_fh - my ($self, $eml) = @_; - my $vmd; - if ($self->{-import_kw}) { # FIXME - my $kw = PublicInbox::MboxReader::mbox_keywords($eml); - $vmd = { kw => $kw } if scalar(@$kw); - } + my ($self, $eml, $vmd) = @_; my $xoids = $self->{lei}->{ale}->xoids_for($eml); $self->{lei}->{sto}->ipc_do('set_eml', $eml, $vmd, $xoids); } sub mbox_cb { # MboxReader callback used by PublicInbox::LeiInput::input_fh my ($eml, $self) = @_; - eml_cb($self, $eml); + my $vmd; + if ($self->{-import_kw}) { + my $kw = PublicInbox::MboxReader::mbox_keywords($eml); + $vmd = { kw => $kw } if scalar(@$kw); + } + eml_cb($self, $eml, $vmd); } sub import_done_wait { # dwaitpid callback @@ -78,16 +78,6 @@ sub lei_import { # the main "lei import" method import_start($lei); } -sub ipc_atfork_child { - my ($self) = @_; - my $lei = $self->{lei}; - delete $lei->{imp}; # drop circular ref - $lei->lei_atfork_child; - $self->SUPER::ipc_atfork_child; - $lei->{auth}->do_auth_atfork($self) if $lei->{auth}; - undef; -} - sub _import_maildir { # maildir_each_eml cb my ($f, $kw, $eml, $sto, $set_kw) = @_; $sto->ipc_do('set_eml', $eml, $set_kw ? { kw => $kw }: ()); @@ -137,6 +127,9 @@ sub import_stdin { $self->input_fh($lei->{opt}->{'in-format'}, $in, ''); } -no warnings 'once'; # the following works even when LeiAuth is lazy-loaded +no warnings 'once'; +*ipc_atfork_child = \&PublicInbox::LeiInput::input_only_atfork_child; + +# the following works even when LeiAuth is lazy-loaded *net_merge_all = \&PublicInbox::LeiAuth::net_merge_all; 1;