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.2 required=3.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF 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 2B6B91F54E for ; Wed, 20 Jul 2022 18:01:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=80x24.org; s=selector1; t=1658340088; bh=+dzB95VcRpmkTK+0iJOO5FY2/c9NFyla4Mo+FNqAbNU=; h=From:To:Subject:Date:From; b=PV532iIXNYw6AvBDKCEV+57FFCXaz275yhBd0mUVMr8cy1pWvkjgIJtY0EwXKbjwr YT/Ndiuy76o86c/PyB8GHbNpP8BVQcYWJW49utV63ztUpOszhW7guf4jx3ML/KCRhF 65WJo9nM0tv+ciLjHKycU9rVEEis0owRinQslNnU= From: Eric Wong To: meta@public-inbox.org Subject: [PATCH] gcf2: avoid excessive checks for unlinked files Date: Wed, 20 Jul 2022 18:01:28 +0000 Message-Id: <20220720180128.25836-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: We were misusing the timer and not expiring it before checking for unlinked files. Now, we check for unlinked files every 60s, instead. --- lib/PublicInbox/Gcf2.pm | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/PublicInbox/Gcf2.pm b/lib/PublicInbox/Gcf2.pm index f546208f..41ee0715 100644 --- a/lib/PublicInbox/Gcf2.pm +++ b/lib/PublicInbox/Gcf2.pm @@ -138,10 +138,12 @@ sub loop (;$) { } else { # check expiry to deal with deleted pack files my $now = clock_gettime(CLOCK_MONOTONIC); $check_at //= $now + $exp; - if ($now > $check_at && have_unlinked_files()) { + if ($now > $check_at) { undef $check_at; - $gcf2 = new(); - %seen = (); + if (have_unlinked_files()) { + $gcf2 = new(); + %seen = (); + } } } }