From: Eric Wong Date: Fri, 14 Jul 2023 20:35:15 +0000 (+0000) Subject: tail_notify: cleanups and wakeup avoidance X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=590023f6c3289810539b0994fd5c3216d81c9259;p=thirdparty%2Fpublic-inbox.git tail_notify: cleanups and wakeup avoidance Avoid adding redundant watches at initialization, and avoid unnecessarily wake ups when no timeout is specified. --- diff --git a/lib/PublicInbox/TailNotify.pm b/lib/PublicInbox/TailNotify.pm index a0347aa5f..cbbc1041d 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);