From: Eric Wong Date: Fri, 26 Jul 2024 21:59:26 +0000 (+0000) Subject: watch: add per-directory scanning diagnostics X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d38f466f021006424f6e77ff95f241a71d2d3cf3;p=thirdparty%2Fpublic-inbox.git watch: add per-directory scanning diagnostics 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 --- diff --git a/lib/PublicInbox/Watch.pm b/lib/PublicInbox/Watch.pm index f793d0d8c..0520967f6 100644 --- a/lib/PublicInbox/Watch.pm +++ b/lib/PublicInbox/Watch.pm @@ -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);