From 7b654d175cf2e31b4354929ea678563f534947e5 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Mon, 30 Jan 2023 04:30:57 +0000 Subject: ipc: drop awaitpid_init to avoid circular refs This brings t/lei-index.t back down from ~8 to ~3s. I didn't notice this before was because the LeiNoteEvent timer was firing every 5s and clearing circular refs and parallel testing meant the delay got hidden. Fixes: 4a2a95bbc78f99c8 (ipc+lei: switch to awaitpid, 2023-01-17) --- lib/PublicInbox/LeiXSearch.pm | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'lib/PublicInbox/LeiXSearch.pm') diff --git a/lib/PublicInbox/LeiXSearch.pm b/lib/PublicInbox/LeiXSearch.pm index f9aa870e..5965274c 100644 --- a/lib/PublicInbox/LeiXSearch.pm +++ b/lib/PublicInbox/LeiXSearch.pm @@ -400,7 +400,7 @@ sub query_remote_mboxrd { sub git { $_[0]->{git} // die 'BUG: git uninitialized' } -sub xsearch_done_wait { # awaitpid cb (via awaitpid_init) +sub xsearch_done_wait { # awaitpid cb my ($pid, $wq, $lei) = @_; return if !$?; my $s = $? & 127; @@ -572,16 +572,16 @@ sub do_query { fcntl($b_r, $F_SETPIPE_SZ, 4096) if $F_SETPIPE_SZ; $l2m->{au_peers} = [ $a_r, $a_w, $b_r, $b_w ]; } - $l2m->awaitpid_init(\&xsearch_done_wait, $lei); $l2m->wq_workers_start('lei2mail', undef, - $lei->oldset, { lei => $lei }); + $lei->oldset, { lei => $lei }, + \&xsearch_done_wait, $lei); pipe($lei->{startq}, $lei->{au_done}) or die "pipe: $!"; fcntl($lei->{startq}, $F_SETPIPE_SZ, 4096) if $F_SETPIPE_SZ; delete $l2m->{au_peers}; } - $self->awaitpid_init(\&xsearch_done_wait, $lei); $self->wq_workers_start('lei_xsearch', undef, - $lei->oldset, { lei => $lei }); + $lei->oldset, { lei => $lei }, + \&xsearch_done_wait, $lei); my $op_c = delete $lei->{pkt_op_c}; delete $lei->{pkt_op_p}; @$end = (); -- cgit v1.2.3-24-ge0c7