From d0100ddd9fe00197cc846d83e70b7611c57dbf43 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sat, 25 Sep 2021 06:17:54 +0000 Subject: lei: make pkt_op easier-to-use and understand Since switching to SOCK_SEQUENTIAL, we no longer have to use fixed-width records to guarantee atomic reads. Thus we can maintain more human-readable/searchable PktOp opcodes. Furthermore, we can infer the subroutine name in many cases to avoid repeating ourselves by specifying a command-name twice (e.g. $ops->{CMD} => [ \&CMD, $obj ]; can now simply be written as: $ops->{CMD} => [ $obj ] if CMD is a method of $obj. --- lib/PublicInbox/LeiToMail.pm | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'lib/PublicInbox/LeiToMail.pm') diff --git a/lib/PublicInbox/LeiToMail.pm b/lib/PublicInbox/LeiToMail.pm index 467b27bf..d42759cf 100644 --- a/lib/PublicInbox/LeiToMail.pm +++ b/lib/PublicInbox/LeiToMail.pm @@ -714,16 +714,15 @@ sub do_post_auth { } else { # Maildir $self->{shard_info} = [ $mod, $shard ]; } - $aug = '+'; # incr_post_augment + $aug = 'incr_post_augment'; } elsif ($self->{-wq_worker_nr} == 0) { # 1st worker do_augment - $aug = '.'; # do_post_augment + $aug = 'do_post_augment'; } if ($aug) { local $0 = 'do_augment'; eval { do_augment($self, $lei) }; $lei->fail($@) if $@; - $lei->{pkt_op_p}->pkt_do($aug) == 1 or - die "do_post_augment trigger: $!"; + $lei->{pkt_op_p}->pkt_do($aug) or die "pkt_do($aug): $!"; } # done augmenting, connect the compressor pipe for each worker if (my $zpipe = delete $lei->{zpipe}) { -- cgit v1.2.3-24-ge0c7