From 954581b8e575966a8bddc35e3b23d81d16a52833 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sun, 28 Mar 2021 09:01:13 +0000 Subject: lei: simplify PktOp callers Provide a consistent ->op_wait_event method instead of forcing callers to loop (or not) at each callsite. This also avoid a leak possibility by avoiding circular references. --- lib/PublicInbox/LeiXSearch.pm | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'lib/PublicInbox/LeiXSearch.pm') diff --git a/lib/PublicInbox/LeiXSearch.pm b/lib/PublicInbox/LeiXSearch.pm index b41daffe..1a194f1c 100644 --- a/lib/PublicInbox/LeiXSearch.pm +++ b/lib/PublicInbox/LeiXSearch.pm @@ -427,7 +427,7 @@ sub do_query { 'incr_start_query' => [ \&incr_start_query, $self, $l2m ], }; $lei->{auth}->op_merge($ops, $l2m) if $l2m && $lei->{auth}; - my $end = $lei->pkt_op_pair($ops); + my $end = $lei->pkt_op_pair; $lei->{1}->autoflush(1); $lei->start_pager if delete $lei->{need_pager}; $lei->{ovv}->ovv_begin($lei); @@ -445,7 +445,7 @@ sub do_query { } $self->wq_workers_start('lei_xsearch', undef, $lei->oldset, { lei => $lei }); - my $op = delete $lei->{pkt_op_c}; + my $op_c = delete $lei->{pkt_op_c}; delete $lei->{pkt_op_p}; @$end = (); $self->{threads} = $lei->{opt}->{threads}; @@ -455,9 +455,7 @@ sub do_query { start_query($self); } $lei->event_step_init; # wait for shutdowns - if ($lei->{oneshot}) { - while ($op->{sock}) { $op->event_step } - } + $op_c->op_wait_event($ops); } sub add_uri { -- cgit v1.2.3-24-ge0c7