]> Sergey Matveev's repositories - public-inbox.git/commitdiff
inboxidle: support Linux::Inotify2 1.x
authorEric Wong <e@yhbt.net>
Sun, 14 Jun 2020 00:25:04 +0000 (00:25 +0000)
committerEric Wong <e@yhbt.net>
Mon, 15 Jun 2020 06:07:54 +0000 (06:07 +0000)
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

index c19b8d186cdcdfd88f13d1f38d11c2d835b5d850..d60d4f239c381e2d8fd07d0247a016da78e30269 100644 (file)
@@ -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;