about summary refs log tree commit homepage
path: root/lib/PublicInbox/HTTPD/Async.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2023-10-08 22:11:48 +0000
committerEric Wong <e@80x24.org>2023-10-08 23:45:36 +0000
commit02cd38ea042e01f343d52f8401cd56cf8e37dd9d (patch)
treeb84a4f69fe8d3009e509a3eaa4706d88e26aa34d /lib/PublicInbox/HTTPD/Async.pm
parent5af390e9da0cafa2a8f757184b356dbdbfc53f18 (diff)
downloadpublic-inbox-02cd38ea042e01f343d52f8401cd56cf8e37dd9d.tar.gz
This is required for reliable epoll/kevent/poll/select
wakeup notifications, since we have no visibility into
the buffer states used internally by Perl.

We can safely use sysread here since we never use the :utf8
nor any :encoding Perl IO layers for readable pipes.

I suspect this fixes occasional failures from t/solver_git.t
when retrieving the WwwCoderepo summary.
Diffstat (limited to 'lib/PublicInbox/HTTPD/Async.pm')
-rw-r--r--lib/PublicInbox/HTTPD/Async.pm4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/PublicInbox/HTTPD/Async.pm b/lib/PublicInbox/HTTPD/Async.pm
index b9d2159c..b73d0c4b 100644
--- a/lib/PublicInbox/HTTPD/Async.pm
+++ b/lib/PublicInbox/HTTPD/Async.pm
@@ -18,6 +18,7 @@ use v5.12;
 use parent qw(PublicInbox::DS);
 use Errno qw(EAGAIN);
 use PublicInbox::Syscall qw(EPOLLIN);
+use PublicInbox::ProcessIONBF;
 
 # This is called via: $env->{'pi-httpd.async'}->()
 # $io is a read-only pipe ($rpipe) for now, but may be a
@@ -37,8 +38,7 @@ sub new {
                 arg => $arg, # arg for $cb
                 end_obj => $end_obj, # like END{}, can ->event_step
         }, $class;
-        my $pp = tied *$io; # ProcessIO
-        $pp->{fh}->blocking(0) // die "$io->blocking(0): $!";
+        PublicInbox::ProcessIONBF->replace($io);
         $self->SUPER::new($io, EPOLLIN);
 }