From cbc2890cb89b81cb6b9e8fabf3f196d9a6110dce Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sun, 19 Sep 2021 12:50:22 +0000 Subject: lei/store: use SOCK_SEQPACKET rather than pipe This has several advantages: * no need to use ipc.lock to protect a pipe for non-atomic writes * ability to pass FDs. In another commit, this will let us simplify lei->sto_done_request and pass newly-created sockets to lei/store directly. disadvantages: - an extra pipe is required for rare messages over several hundred KB, this is probably a non-issue, though The performance delta is unknown, but I expect shards (which remain pipes) to be the primary bottleneck IPC-wise for lei/store. --- lib/PublicInbox/LeiXSearch.pm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lib/PublicInbox/LeiXSearch.pm') diff --git a/lib/PublicInbox/LeiXSearch.pm b/lib/PublicInbox/LeiXSearch.pm index 1d49da3d..4583b067 100644 --- a/lib/PublicInbox/LeiXSearch.pm +++ b/lib/PublicInbox/LeiXSearch.pm @@ -269,7 +269,7 @@ sub each_remote_eml { # callback for MboxReader->mboxrd my $xoids = $lei->{ale}->xoids_for($eml, 1); my $smsg = bless {}, 'PublicInbox::Smsg'; if ($self->{import_sto} && !$xoids) { - my $res = $self->{import_sto}->ipc_do('add_eml', $eml); + my $res = $self->{import_sto}->wq_do('add_eml', $eml); if (ref($res) eq ref($smsg)) { # totally new message $smsg = $res; $smsg->{kw} = []; # short-circuit xsmsg_vmd @@ -369,7 +369,7 @@ sub query_remote_mboxrd { @$reap_curl = (); # cancel OnDestroy die $err if $err; my $nr = $lei->{-nr_remote_eml}; - my $wait = $lei->{sto}->ipc_do('done') if $nr && $lei->{sto}; + my $wait = $lei->{sto}->wq_do('done') if $nr && $lei->{sto}; if ($? == 0) { # don't update if no results, maybe MTA is down $key && $nr and @@ -413,7 +413,7 @@ sub query_done { # EOF callback for main daemon warn "BUG: {sto} missing with --mail-sync"; } $lei->sto_done_request if $lei->{sto}; - my $wait = $lei->{v2w} ? $lei->{v2w}->ipc_do('done') : undef; + my $wait = $lei->{v2w} ? $lei->{v2w}->wq_do('done') : undef; $lei->{ovv}->ovv_end($lei); my $start_mua; if ($l2m) { # close() calls LeiToMail reap_compress -- cgit v1.2.3-24-ge0c7