* [PATCH] fake_inotify: increase directory ctime adjustment window
@ 2023-09-08 12:54 7% Eric Wong
0 siblings, 0 replies; 1+ results
From: Eric Wong @ 2023-09-08 12:54 UTC (permalink / raw)
To: meta
It actually needs to be bigger than the polling interval.
I suspect I missed this due to parallel tests on a loaded
VM, but running t/dir_idle.t on an unloaded machine reproduces
the problem when neither IO::KQueue nor Linux::Inotify2 are
present.
---
lib/PublicInbox/FakeInotify.pm | 3 ++-
t/dir_idle.t | 4 +++-
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/lib/PublicInbox/FakeInotify.pm b/lib/PublicInbox/FakeInotify.pm
index 3a09b030..8be07135 100644
--- a/lib/PublicInbox/FakeInotify.pm
+++ b/lib/PublicInbox/FakeInotify.pm
@@ -92,7 +92,8 @@ sub dir_adj ($) {
my ($old_ctime) = @_;
my $now = Time::HiRes::time;
my $diff = $now - $old_ctime;
- ($diff > -1 && $diff < 1) ? 1 : 0;
+ my $adj = $poll_intvl + 1;
+ ($diff > -$adj && $diff < $adj) ? 1 : 0;
}
# behaves like non-blocking Linux::Inotify2->read
diff --git a/t/dir_idle.t b/t/dir_idle.t
index 9e66cc58..bb6f47eb 100644
--- a/t/dir_idle.t
+++ b/t/dir_idle.t
@@ -16,9 +16,11 @@ my $end = 3 + now;
local @PublicInbox::DS::post_loop_do = (sub { scalar(@x) == 0 && now < $end });
rmdir("$tmpdir/a/b") or xbail "rmdir $!";
PublicInbox::DS::event_loop();
-is(scalar(@x), 1, 'got an rmdir event') and
+is(scalar(@x), 1, 'got an rmdir event') or xbail explain(\@x);
+if (@x) {
is($x[0]->[0]->fullname, "$tmpdir/a/b", 'got expected fullname') and
ok($x[0]->[0]->IN_DELETE, 'IN_DELETE set');
+}
rmdir("$tmpdir/a") or xbail "rmdir $!";
@x = ();
^ permalink raw reply related [relevance 7%]
Results 1-1 of 1 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2023-09-08 12:54 7% [PATCH] fake_inotify: increase directory ctime adjustment window Eric Wong
Code repositories for project(s) associated with this public inbox
https://80x24.org/public-inbox.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).