* [PATCH 09/12] lei_xsearch: reduce reference paths to lxs
2021-01-21 19:46 6% [PATCH 00/12] lei: another dump Eric Wong
@ 2021-01-21 19:46 7% ` Eric Wong
0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2021-01-21 19:46 UTC (permalink / raw)
To: meta
Having an extra reference to LeiXSearch from the OpPipe $done_op
map is unnecessary and makes the reference graph more complex
than it needs to be. Just use $lei->{lxs} to simplify and
reduce the likelyhood of bugs.
---
lib/PublicInbox/LeiXSearch.pm | 30 +++++++++++++++---------------
1 file changed, 15 insertions(+), 15 deletions(-)
diff --git a/lib/PublicInbox/LeiXSearch.pm b/lib/PublicInbox/LeiXSearch.pm
index 7b33677e..987a9896 100644
--- a/lib/PublicInbox/LeiXSearch.pm
+++ b/lib/PublicInbox/LeiXSearch.pm
@@ -192,12 +192,14 @@ sub git {
}
sub query_done { # EOF callback
- my ($self, $lei) = @_;
- my $l2m = delete $lei->{l2m};
- $l2m->wq_wait_old if $l2m;
- $self->wq_wait_old;
+ my ($lei) = @_;
+ my $has_l2m = exists $lei->{l2m};
+ for my $f (qw(lxs l2m)) {
+ my $wq = delete $lei->{$f} or next;
+ $wq->wq_wait_old;
+ }
$lei->{ovv}->ovv_end($lei);
- if ($l2m) { # close() calls LeiToMail reap_compress
+ if ($has_l2m) { # close() calls LeiToMail reap_compress
close(delete($lei->{1})) if $lei->{1};
$lei->start_mua;
}
@@ -246,16 +248,14 @@ sub query_prepare { # called by wq_do
syswrite($lei->{0}, '.') == 1 or die "do_post_augment trigger: $!";
}
-sub sigpipe_handler { # handles SIGPIPE from wq workers
- my ($self, $lei_orig) = @_;
- if ($self->wq_kill_old) {
+sub sigpipe_handler { # handles SIGPIPE from l2m/lxs workers
+ my ($lei) = @_;
+ my $lxs = delete $lei->{lxs};
+ if ($lxs && $lxs->wq_kill_old) {
kill 'PIPE', $$;
- $self->wq_wait_old;
- } else {
- $self->wq_kill;
- $self->wq_close;
+ $lxs->wq_wait_old;
}
- close(delete $lei_orig->{1}) if $lei_orig->{1};
+ close(delete $lei->{1}) if $lei->{1};
}
sub do_query {
@@ -266,8 +266,8 @@ sub do_query {
$lei_orig->event_step_init; # wait for shutdowns
my $done_op = {
- '' => [ \&query_done, $self, $lei_orig ],
- '!' => [ \&sigpipe_handler, $self, $lei_orig ]
+ '' => [ \&query_done, $lei_orig ],
+ '!' => [ \&sigpipe_handler, $lei_orig ]
};
my $in_loop = exists $lei_orig->{sock};
$done = PublicInbox::OpPipe->new($done, $done_op, $in_loop);
^ permalink raw reply related [relevance 7%]
* [PATCH 00/12] lei: another dump
@ 2021-01-21 19:46 6% Eric Wong
2021-01-21 19:46 7% ` [PATCH 09/12] lei_xsearch: reduce reference paths to lxs Eric Wong
0 siblings, 1 reply; 2+ results
From: Eric Wong @ 2021-01-21 19:46 UTC (permalink / raw)
To: meta
1/12 is a user-visible change, but there's no users, yet :P
more externals work coming...
12/12 may be too specific to bash, help from non-bash users
appreciated
Eric Wong (12):
lei_overview: rename {relevance} => {pct}
lei q: retrieve keywords for local, non-external messages
lei_xsearch: eliminate some unused, commented-out code
lei: show {pct} and {oid} in From_ lines and filenames
lei: fix inadvertant FD sharing
lei_to_mail: avoid segfault on exit
lei: oneshot: use client $io[2] for placeholder
lei: remove INT/QUIT/TERM handlers, fix daemon EOF
lei_xsearch: reduce reference paths to lxs
lei: remove @TO_CLOSE_ATFORK_CHILD
lei: forget-external support with canonicalization
lei forget-external: bash completion support
MANIFEST | 1 +
lib/PublicInbox/IPC.pm | 23 +++++++--
lib/PublicInbox/LEI.pm | 86 ++++++++++++++++++++--------------
lib/PublicInbox/LeiExternal.pm | 71 ++++++++++++++++++++++++----
lib/PublicInbox/LeiOverview.pm | 17 +++----
lib/PublicInbox/LeiQuery.pm | 21 +++++----
lib/PublicInbox/LeiSearch.pm | 16 ++-----
lib/PublicInbox/LeiToMail.pm | 80 ++++++++++++++++++-------------
lib/PublicInbox/LeiXSearch.pm | 60 ++++++++++++------------
lib/PublicInbox/Search.pm | 20 +++++++-
script/lei | 5 --
t/lei.t | 9 ++++
t/lei_external.t | 18 +++++++
t/lei_to_mail.t | 41 +++++++++-------
14 files changed, 300 insertions(+), 168 deletions(-)
create mode 100644 t/lei_external.t
^ permalink raw reply [relevance 6%]
Results 1-2 of 2 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2021-01-21 19:46 6% [PATCH 00/12] lei: another dump Eric Wong
2021-01-21 19:46 7% ` [PATCH 09/12] lei_xsearch: reduce reference paths to lxs Eric Wong
Code repositories for project(s) associated with this public inbox
https://80x24.org/public-inbox.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).