about summary refs log tree commit homepage
diff options
context:
space:
mode:
-rw-r--r--lib/PublicInbox/FakeInotify.pm3
-rw-r--r--t/dir_idle.t4
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 = ();