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/LeiNoteEvent.pm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'lib/PublicInbox/LeiNoteEvent.pm') diff --git a/lib/PublicInbox/LeiNoteEvent.pm b/lib/PublicInbox/LeiNoteEvent.pm index 18313359..5f692e75 100644 --- a/lib/PublicInbox/LeiNoteEvent.pm +++ b/lib/PublicInbox/LeiNoteEvent.pm @@ -36,18 +36,18 @@ sub eml_event ($$$$) { my ($self, $eml, $vmd, $state) = @_; my $sto = $self->{lei}->{sto}; if ($state =~ /\Aimport-(?:rw|ro)\z/) { - $sto->ipc_do('set_eml', $eml, $vmd); + $sto->wq_do('set_eml', $eml, $vmd); } elsif ($state =~ /\Aindex-(?:rw|ro)\z/) { my $xoids = $self->{lei}->ale->xoids_for($eml); - $sto->ipc_do('index_eml_only', $eml, $vmd, $xoids); + $sto->wq_do('index_eml_only', $eml, $vmd, $xoids); } elsif ($state =~ /\Atag-(?:rw|ro)\z/) { my $docids = []; my $c = $self->{lse}->kw_changed($eml, $vmd->{kw}, $docids); if (scalar @$docids) { # already in lei/store - $sto->ipc_do('set_eml_vmd', undef, $vmd, $docids) if $c; + $sto->wq_do('set_eml_vmd', undef, $vmd, $docids) if $c; } elsif (my $xoids = $self->{lei}->ale->xoids_for($eml)) { # it's in an external, only set kw, here - $sto->ipc_do('set_xvmd', $xoids, $eml, $vmd); + $sto->wq_do('set_xvmd', $xoids, $eml, $vmd); } # else { totally unknown: ignore } else { warn "unknown state: $state (in $self->{lei}->{cfg}->{'-f'})\n"; -- cgit v1.2.3-24-ge0c7