]> git.ipfire.org Git - thirdparty/public-inbox.git/commitdiff
watch: add per-directory scanning diagnostics
authorEric Wong <e@80x24.org>
Fri, 26 Jul 2024 21:59:26 +0000 (21:59 +0000)
committerEric Wong <e@80x24.org>
Tue, 30 Jul 2024 23:26:29 +0000 (23:26 +0000)
This may help track down problems associated with a single
directory.  Note we emit a separate message for each of the
`new' and `cur' subdirectories of a Maildir.  Full scans only
happen at startup (or manually), so it shouldn't be too noisy
if logging to syslog.

Requested-by: Robin H. Johnson <robbat2@orbis-terrarum.net>
lib/PublicInbox/Watch.pm

index f793d0d8c4b14a904d6e753daa0f720b02964cd7..0520967f683a43f5eaf8bd1ef1abade26d451d4a 100644 (file)
@@ -590,7 +590,9 @@ sub fs_scan_step {
                my $dh;
                if (ref($dir) eq 'ARRAY') { # continue existing
                        ($dir, $dh) = @$dir;
-               } elsif (!opendir($dh, $dir)) {
+               } elsif (opendir($dh, $dir)) {
+                       warn "# scanning $dir ...\n";
+               } else {
                        warn "W: failed to open $dir: $! (non-fatal)\n";
                        next;
                }
@@ -602,6 +604,8 @@ sub fs_scan_step {
                if ($n < 0) {
                        unshift @{$self->{scan_q}}, [ $dir, $dh ];
                        last;
+               } else {
+                       warn "# done scanning $dir\n";
                }
        }
        _done_for_now($self);