]> git.ipfire.org Git - thirdparty/public-inbox.git/commitdiff
watch: more details about full scan start/completion
authorEric Wong <e@80x24.org>
Fri, 26 Jul 2024 21:59:24 +0000 (21:59 +0000)
committerEric Wong <e@80x24.org>
Tue, 30 Jul 2024 23:26:27 +0000 (23:26 +0000)
Start and stop happens infrequently and may be useful for
diagnosing problems about missing messages.  A future change
will add more details about per-directory scans.

Requested-by: Robin H. Johnson <robbat2@orbis-terrarum.net>
lib/PublicInbox/Watch.pm
script/public-inbox-watch
t/watch_filter_rubylang.t

index eb90d353f3e7d39a50c23b7737b51ac5bb4cd676..74cc599c7c70a6c86a30f5a83eafb0bf37ff1a69 100644 (file)
@@ -620,7 +620,8 @@ sub fs_scan_step {
        }
        _done_for_now($self);
        # do we have more work to do?
-       PublicInbox::DS::requeue($self) if keys %$opendirs;
+       keys(%$opendirs) ? PublicInbox::DS::requeue($self)
+               : warn("# full scan complete\n");
 }
 
 sub scan {
index 9bcd42edd1d104b6fbd4fbfb61411a118b5acd78..64300f09539e056e1e86da274e5a13e15870ef5c 100755 (executable)
@@ -40,7 +40,8 @@ my $reload = sub {
 if ($watch) {
        my $scan = sub {
                return if !$watch;
-               warn "# scanning\n";
+               my ($s) = @_;
+               warn "# scanning (full) ", ($s ? "on $s" : 'at startup'), "\n";
                $watch->trigger_scan('full');
        };
        my $quit = sub { # may be called in IMAP/NNTP children
index f72feb9f87f267dafe37766fea2228d61e126283..81f6b00e1dc1a27cd00b8cd0d19888ffef433a05 100644 (file)
@@ -103,7 +103,7 @@ EOM
        $ibx->{-no_fsync} = 1;
        is($ibx->search->reopen->mset('b:spam')->size, 0, 'spam removed');
 
-       is_deeply([], \@warn, 'no warnings');
+       is_deeply [], [ grep !/^#/, @warn ], 'no warnings';
 }
 
 done_testing();