From: Eric Wong Date: Wed, 20 Jul 2022 18:01:28 +0000 (+0000) Subject: gcf2: avoid excessive checks for unlinked files X-Git-Tag: v1.9.0~94 X-Git-Url: http://www.git.stargrave.org/?p=public-inbox.git;a=commitdiff_plain;h=596285b51b02163204fb92877561cd6b935888e8 gcf2: avoid excessive checks for unlinked files We were misusing the timer and not expiring it before checking for unlinked files. Now, we check for unlinked files every 60s, instead. --- 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 = (); + } } } }