about summary refs log tree commit homepage
path: root/lib/PublicInbox/TailNotify.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2023-07-14 20:35:15 +0000
committerEric Wong <e@80x24.org>2023-07-15 21:32:27 +0000
commit590023f6c3289810539b0994fd5c3216d81c9259 (patch)
tree6305d93465e7c08bf1967e29eefbd01d97304713 /lib/PublicInbox/TailNotify.pm
parent57f0c3206fdf94076e23c1ac6d49cbbf547971e5 (diff)
downloadpublic-inbox-590023f6c3289810539b0994fd5c3216d81c9259.tar.gz
Avoid adding redundant watches at initialization, and avoid
unnecessarily wake ups when no timeout is specified.
Diffstat (limited to 'lib/PublicInbox/TailNotify.pm')
-rw-r--r--lib/PublicInbox/TailNotify.pm3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/PublicInbox/TailNotify.pm b/lib/PublicInbox/TailNotify.pm
index a0347aa5..cbbc1041 100644
--- a/lib/PublicInbox/TailNotify.pm
+++ b/lib/PublicInbox/TailNotify.pm
@@ -43,7 +43,6 @@ sub new {
         } else {
                 $self->{inot} = PublicInbox::FakeInotify->new;
         }
-        $self->{inot}->watch($fn, $TAIL_MOD);
         reopen_file($self);
         $self->{inot}->watch($fn, $TAIL_MOD);
         $self;
@@ -64,6 +63,8 @@ again:
                         if (defined $end) {
                                 $wait = $end - now;
                                 $wait = 0 if $wait < 0;
+                        } else {
+                                undef $wait;
                         }
                 }
                 select($rfds, undef, undef, $wait);