From 192dd6249c1960380241d73d099d5477028c259a Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sun, 14 Jun 2020 00:25:04 +0000 Subject: [PATCH] inboxidle: support Linux::Inotify2 1.x Linux::Inotify2 1.x lacked ->on_overflow and ->broadcast methods. Just don't use them for now. We may eventually provide a pure Perl alternative which doesn't require closures, XS, or the common::sense dependency. Overflowing the inotify queue seems difficult to trigger at the moment: /proc/sys/fs/inotify/max_queued_events defaults to 16384 on a my CentOS 7.x VM with 2GB RAM. --- lib/PublicInbox/InboxIdle.pm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/PublicInbox/InboxIdle.pm b/lib/PublicInbox/InboxIdle.pm index c19b8d18..d60d4f23 100644 --- a/lib/PublicInbox/InboxIdle.pm +++ b/lib/PublicInbox/InboxIdle.pm @@ -58,7 +58,10 @@ sub new { my $sock = gensym; tie *$sock, 'PublicInbox::In2Tie', $inot; $inot->blocking(0); - $inot->on_overflow(undef); # broadcasts everything on overflow + if ($inot->can('on_overflow')) { + # broadcasts everything on overflow + $inot->on_overflow(undef); + } $self->SUPER::new($sock, EPOLLIN | EPOLLET); } else { require PublicInbox::FakeInotify; -- 2.44.0