unofficial mirror of meta@public-inbox.org
 help / color / mirror / Atom feed
From: Eric Wong <e@80x24.org>
To: meta@public-inbox.org
Cc: "Robin H . Johnson" <robbat2@orbis-terrarum.net>
Subject: [PATCH 3/3] watch: add per-directory scanning diagnostics
Date: Fri, 26 Jul 2024 21:59:26 +0000	[thread overview]
Message-ID: <20240726215926.3357961-4-e@80x24.org> (raw)
In-Reply-To: <20240726215926.3357961-1-e@80x24.org>

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 | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/lib/PublicInbox/Watch.pm b/lib/PublicInbox/Watch.pm
index f793d0d8..0520967f 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);

      parent reply	other threads:[~2024-07-26 21:59 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-26 21:59 [PATCH 0/3] public-inbox-watch Maildir diagnostics Eric Wong
2024-07-26 21:59 ` [PATCH 1/3] watch: more details about full scan start/completion Eric Wong
2024-07-26 21:59 ` [PATCH 2/3] watch: only open one directory at a time when scanning Eric Wong
2024-07-26 21:59 ` Eric Wong [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://public-inbox.org/README

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240726215926.3357961-4-e@80x24.org \
    --to=e@80x24.org \
    --cc=meta@public-inbox.org \
    --cc=robbat2@orbis-terrarum.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).