about summary refs log tree commit homepage
path: root/lib/PublicInbox/KQNotify.pm
diff options
context:
space:
mode:
authorEric Wong <e@yhbt.net>2020-06-24 18:45:07 +0000
committerEric Wong <e@yhbt.net>2020-06-25 05:37:45 +0000
commitf977826a17f8735e6947dd2da380df8c6d0b38d8 (patch)
treea3879cdbfd7ba1ac32008173d163d8f5f4163fbb /lib/PublicInbox/KQNotify.pm
parent7601f7d864d74dae58ee248e426527fb2ebe74a5 (diff)
downloadpublic-inbox-f977826a17f8735e6947dd2da380df8c6d0b38d8.tar.gz
We can reduce the amount of platform-specific code by always
relying on IN_MODIFY/NOTE_WRITE notifications from lock release.
This reduces the number of times our read-only daemons will
need to wake up when -watch sees no-op message changes
(e.g. replied, seen, recent flag changes).
Diffstat (limited to 'lib/PublicInbox/KQNotify.pm')
-rw-r--r--lib/PublicInbox/KQNotify.pm8
1 files changed, 2 insertions, 6 deletions
diff --git a/lib/PublicInbox/KQNotify.pm b/lib/PublicInbox/KQNotify.pm
index 1b5c578e..110594cc 100644
--- a/lib/PublicInbox/KQNotify.pm
+++ b/lib/PublicInbox/KQNotify.pm
@@ -8,10 +8,6 @@ use strict;
 use IO::KQueue;
 use PublicInbox::DSKQXS; # wraps IO::KQueue for fork-safe DESTROY
 
-# only true as far as public-inbox is concerned with .lock files:
-sub IN_CLOSE () { NOTE_WRITE }
-#sub IN_CLOSE () { 0x200 } # NOTE_CLOSE_WRITE (FreeBSD 11+ only)
-
 sub new {
         my ($class) = @_;
         bless { dskq => PublicInbox::DSKQXS->new, watch => {} }, $class;
@@ -26,7 +22,7 @@ sub watch {
                 EV_ADD | EV_CLEAR, # flags
                 $mask, # fflags
                 0, 0); # data, udata
-        if ($mask == IN_CLOSE) {
+        if ($mask == NOTE_WRITE) {
                 $self->{watch}->{$ident} = [ $fh, $cb ];
         } else {
                 die "TODO Not implemented: $mask";
@@ -52,7 +48,7 @@ sub poll {
         for my $kev (@kevents) {
                 my $ident = $kev->[KQ_IDENT];
                 my $mask = $kev->[KQ_FFLAGS];
-                if (($mask & IN_CLOSE) == IN_CLOSE) {
+                if (($mask & NOTE_WRITE) == NOTE_WRITE) {
                         eval { $self->{watch}->{$ident}->[1]->() };
                 }
         }