From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.2 required=3.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, T_SCC_BODY_TEXT_LINE shortcircuit=no autolearn=ham autolearn_force=no version=3.4.6 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id D53721F545 for ; Fri, 14 Jul 2023 20:35:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=80x24.org; s=selector1; t=1689366919; bh=nhgSStuDO7lvbJI4gVAcU1DSI0xDWai9KhXPBydowac=; h=From:To:Subject:Date:From; b=sPVY8h3P2HztdL9zJ6iYkApBCt5rRMWbnF4Gu+prP0zJkhN87Dn92GIitbWJC0JN+ s2X+GfsDYMmFCb+S4LadugoRuVxLd5r2xf8c2P6MluBD68/SvaReHcDKKQmgU25gHQ LkgyomckJKbgDJUEK98xHVuCPtM1NfF5H0B+qfH0= From: Eric Wong To: meta@public-inbox.org Subject: [PATCH] tail_notify: cleanups and wakeup avoidance Date: Fri, 14 Jul 2023 20:35:15 +0000 Message-ID: <20230714203515.47129-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: Avoid adding redundant watches at initialization, and avoid unnecessarily wake ups when no timeout is specified. --- lib/PublicInbox/TailNotify.pm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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);