diff options
author | Eric Wong <e@80x24.org> | 2021-09-19 12:50:23 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2021-09-19 19:52:46 +0000 |
commit | 7df294d19a7d8b2a35532375e75c8a879840dd04 (patch) | |
tree | 0182cdeab3849d35d463eba47b5a87184e6d6b3b /lib/PublicInbox/LEI.pm | |
parent | cbc2890cb89b81cb6b9e8fabf3f196d9a6110dce (diff) | |
download | public-inbox-7df294d19a7d8b2a35532375e75c8a879840dd04.tar.gz |
With the switch from pipes to sockets for lei-daemon => lei/store IPC, we can send the script/lei client socket to the lei/store process and rely on reference counting in both Perl and the kernel to persist the script/lei.
Diffstat (limited to 'lib/PublicInbox/LEI.pm')
-rw-r--r-- | lib/PublicInbox/LEI.pm | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/lib/PublicInbox/LEI.pm b/lib/PublicInbox/LEI.pm index 549b855b..f62e82dc 100644 --- a/lib/PublicInbox/LEI.pm +++ b/lib/PublicInbox/LEI.pm @@ -40,7 +40,6 @@ $GLP_PASS->configure(qw(gnu_getopt no_ignore_case auto_abbrev pass_through)); our %PATH2CFG; # persistent for socket daemon our $MDIR2CFGPATH; # /path/to/maildir => { /path/to/config => [ ino watches ] } -our %LIVE_SOCK; # "GLOB(0x....)" => $lei->{sock} # TBD: this is a documentation mechanism to show a subcommand # (may) pass options through to another command: @@ -580,7 +579,6 @@ sub _lei_atfork_child { $dir_idle->force_close if $dir_idle; %PATH2CFG = (); $MDIR2CFGPATH = {}; - %LIVE_SOCK = (); eval 'no warnings; undef $PublicInbox::LeiNoteEvent::to_flush'; undef $errors_log; $quit = \&CORE::exit; @@ -619,7 +617,6 @@ sub pkt_ops { $ops->{x_it} = [ \&x_it, $lei ]; $ops->{child_error} = [ \&child_error, $lei ]; $ops->{incr} = [ \&incr, $lei ]; - $ops->{sto_done_request} = [ \&sto_done_request, $lei, $lei->{sock} ]; $ops; } @@ -1496,12 +1493,11 @@ sub lms { (-f $f || $rw) ? PublicInbox::LeiMailSync->new($f) : undef; } -sub sto_done_request { # only call this from lei-daemon process (not workers) +sub sto_done_request { my ($lei, $sock) = @_; eval { if ($sock //= $lei->{sock}) { # issue, async wait - $LIVE_SOCK{"$sock"} = $sock; - $lei->{sto}->wq_do('done', "$sock"); + $lei->{sto}->wq_io_do('done', [ $sock ]); } else { # forcibly wait my $wait = $lei->{sto}->wq_do('done'); } @@ -1509,9 +1505,4 @@ sub sto_done_request { # only call this from lei-daemon process (not workers) $lei->err($@) if $@; } -sub sto_done_complete { # called in lei-daemon when LeiStore->done is complete - my ($sock_str) = @_; - delete $LIVE_SOCK{$sock_str}; # frees {sock} for waiting lei clients -} - 1; |