From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 0E3C91F8C8 for ; Mon, 4 Oct 2021 08:26:34 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH] {dir,inbox}idle: use level-triggered epoll Date: Mon, 4 Oct 2021 08:26:33 +0000 Message-Id: <20211004082633.9400-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: Both read(2) on inotify and kevent(2) have a finite amount of This can prevent missed/delayed notifications while still ensuring fairness in busy event loops. --- lib/PublicInbox/DirIdle.pm | 4 ++-- lib/PublicInbox/InboxIdle.pm | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/PublicInbox/DirIdle.pm b/lib/PublicInbox/DirIdle.pm index d572c2749f7f..c9a293e9355a 100644 --- a/lib/PublicInbox/DirIdle.pm +++ b/lib/PublicInbox/DirIdle.pm @@ -5,7 +5,7 @@ package PublicInbox::DirIdle; use strict; use parent 'PublicInbox::DS'; -use PublicInbox::Syscall qw(EPOLLIN EPOLLET); +use PublicInbox::Syscall qw(EPOLLIN); use PublicInbox::In2Tie; my ($MAIL_IN, $MAIL_GONE, $ino_cls); @@ -38,7 +38,7 @@ sub new { if ($ino_cls) { $inot = $ino_cls->new or die "E: $ino_cls->new: $!"; my $io = PublicInbox::In2Tie::io($inot); - $self->SUPER::new($io, EPOLLIN | EPOLLET); + $self->SUPER::new($io, EPOLLIN); } else { require PublicInbox::FakeInotify; $inot = PublicInbox::FakeInotify->new; # starts timer diff --git a/lib/PublicInbox/InboxIdle.pm b/lib/PublicInbox/InboxIdle.pm index 4d74b3545902..2781b3e15bb9 100644 --- a/lib/PublicInbox/InboxIdle.pm +++ b/lib/PublicInbox/InboxIdle.pm @@ -7,7 +7,7 @@ package PublicInbox::InboxIdle; use strict; use parent qw(PublicInbox::DS); -use PublicInbox::Syscall qw(EPOLLIN EPOLLET); +use PublicInbox::Syscall qw(EPOLLIN); my $IN_MODIFY = 0x02; # match Linux inotify my $ino_cls; if ($^O eq 'linux' && eval { require Linux::Inotify2; 1 }) { @@ -73,7 +73,7 @@ sub new { if ($ino_cls) { $inot = $ino_cls->new or die "E: $ino_cls->new: $!"; my $io = PublicInbox::In2Tie::io($inot); - $self->SUPER::new($io, EPOLLIN | EPOLLET); + $self->SUPER::new($io, EPOLLIN); } else { require PublicInbox::FakeInotify; $inot = PublicInbox::FakeInotify->new;