about summary refs log tree commit homepage
path: root/lib/PublicInbox/LeiNoteEvent.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2022-07-19 22:42:52 +0000
committerEric Wong <e@80x24.org>2022-07-20 03:54:27 +0000
commit49684178901a3d5db198032da1bb831b2b3e0b65 (patch)
tree7c19828248f589d06cb34fbfb69cee129c4e1366 /lib/PublicInbox/LeiNoteEvent.pm
parent840785917bc74c8e7df226463144185294047d75 (diff)
downloadpublic-inbox-49684178901a3d5db198032da1bb831b2b3e0b65.tar.gz
Enqueuing "note-event" requests from the DS event loop must
not wait on workers being able to drain the queue quickly
enough.  Thus we make the SOCK_SEQPACKET writes nonblocking
and rely on the lei-daemon event loop to enqueue writes.

This is a unique problem for "note-event" since it reuses
workers in between commands, while most lei commands currently
fork off new workers.
Diffstat (limited to 'lib/PublicInbox/LeiNoteEvent.pm')
-rw-r--r--lib/PublicInbox/LeiNoteEvent.pm5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/PublicInbox/LeiNoteEvent.pm b/lib/PublicInbox/LeiNoteEvent.pm
index db387633..93f80116 100644
--- a/lib/PublicInbox/LeiNoteEvent.pm
+++ b/lib/PublicInbox/LeiNoteEvent.pm
@@ -58,7 +58,7 @@ sub eml_event ($$$$) {
         }
 }
 
-sub maildir_event { # via wq_io_do
+sub maildir_event { # via wq_nonblock_do
         my ($self, $fn, $vmd, $state) = @_;
         if (my $eml = PublicInbox::InboxWritable::eml_from_path($fn)) {
                 eml_event($self, $eml, $vmd, $state);
@@ -93,6 +93,7 @@ sub lei_note_event {
                 my ($op_c, $ops) = $lei->workers_start($wq, $jobs);
                 $lei->wait_wq_events($op_c, $ops);
                 note_event_arm_done($lei);
+                $wq->prepare_nonblock;
                 $lei->{lne} = $wq;
         };
         if ($folder =~ /\Amaildir:/i) {
@@ -101,7 +102,7 @@ sub lei_note_event {
                 return if index($fl, 'T') >= 0;
                 my $kw = PublicInbox::MdirReader::flags2kw($fl);
                 my $vmd = { kw => $kw, sync_info => [ $folder, \$bn ] };
-                $self->wq_do('maildir_event', $fn, $vmd, $state);
+                $self->wq_nonblock_do('maildir_event', $fn, $vmd, $state);
         } # else: TODO: imap
 }