about summary refs log tree commit homepage
path: root/lib/PublicInbox/LeiXSearch.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2021-03-28 09:01:13 +0000
committerEric Wong <e@80x24.org>2021-03-28 23:01:36 +0000
commit954581b8e575966a8bddc35e3b23d81d16a52833 (patch)
treed5e87f75313f827411796d82871fd6b1d5388e9c /lib/PublicInbox/LeiXSearch.pm
parent29792d70a5d8305f68521664a7fa2e0fe54ff291 (diff)
downloadpublic-inbox-954581b8e575966a8bddc35e3b23d81d16a52833.tar.gz
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.
Diffstat (limited to 'lib/PublicInbox/LeiXSearch.pm')
-rw-r--r--lib/PublicInbox/LeiXSearch.pm8
1 files changed, 3 insertions, 5 deletions
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 {