From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 6C9D71FFB0 for ; Wed, 3 Feb 2021 08:11:44 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 03/11] pkt_op: rely on DS::in_loop global Date: Tue, 2 Feb 2021 22:11:35 -1000 Message-Id: <20210203081143.24424-4-e@80x24.org> In-Reply-To: <20210203081143.24424-1-e@80x24.org> References: <20210203081143.24424-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: No reason to check for $lei->{oneshot} here. --- lib/PublicInbox/LeiXSearch.pm | 2 +- lib/PublicInbox/PktOp.pm | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/PublicInbox/LeiXSearch.pm b/lib/PublicInbox/LeiXSearch.pm index 37bd233e..23a9c020 100644 --- a/lib/PublicInbox/LeiXSearch.pm +++ b/lib/PublicInbox/LeiXSearch.pm @@ -421,7 +421,7 @@ sub do_query { '' => [ \&query_done, $lei ], 'mset_progress' => [ \&mset_progress, $lei ], }; - (my $op, $lei->{pkt_op}) = PublicInbox::PktOp->pair($ops, !$lei->{oneshot}); + (my $op, $lei->{pkt_op}) = PublicInbox::PktOp->pair($ops); my ($lei_ipc, @io) = $lei->atfork_parent_wq($self); delete($lei->{pkt_op}); diff --git a/lib/PublicInbox/PktOp.pm b/lib/PublicInbox/PktOp.pm index 59b37ff8..40c7262a 100644 --- a/lib/PublicInbox/PktOp.pm +++ b/lib/PublicInbox/PktOp.pm @@ -17,9 +17,9 @@ use PublicInbox::IPC qw(ipc_freeze ipc_thaw); our @EXPORT_OK = qw(pkt_do); sub new { - my ($cls, $r, $ops, $in_loop) = @_; - my $self = bless { sock => $r, ops => $ops, re => [] }, $cls; - if ($in_loop) { # iff using DS->EventLoop + my ($cls, $r, $ops) = @_; + my $self = bless { sock => $r, ops => $ops }, $cls; + if ($PublicInbox::DS::in_loop) { # iff using DS->EventLoop $r->blocking(0); $self->SUPER::new($r, EPOLLIN|EPOLLET); } @@ -28,10 +28,10 @@ sub new { # returns a blessed object as the consumer, and a GLOB/IO for the producer sub pair { - my ($cls, $ops, $in_loop) = @_; + my ($cls, $ops) = @_; my ($c, $p); socketpair($c, $p, AF_UNIX, SOCK_SEQPACKET, 0) or die "socketpair: $!"; - (new($cls, $c, $ops, $in_loop), $p); + (new($cls, $c, $ops), $p); } sub pkt_do { # for the producer to trigger event_step in consumer