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 1/3] watch: more details about full scan start/completion
Date: Fri, 26 Jul 2024 21:59:24 +0000	[thread overview]
Message-ID: <20240726215926.3357961-2-e@80x24.org> (raw)
In-Reply-To: <20240726215926.3357961-1-e@80x24.org>

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  | 3 ++-
 script/public-inbox-watch | 3 ++-
 t/watch_filter_rubylang.t | 2 +-
 3 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/lib/PublicInbox/Watch.pm b/lib/PublicInbox/Watch.pm
index eb90d353..74cc599c 100644
--- a/lib/PublicInbox/Watch.pm
+++ b/lib/PublicInbox/Watch.pm
@@ -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 {
diff --git a/script/public-inbox-watch b/script/public-inbox-watch
index 9bcd42ed..64300f09 100755
--- a/script/public-inbox-watch
+++ b/script/public-inbox-watch
@@ -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
diff --git a/t/watch_filter_rubylang.t b/t/watch_filter_rubylang.t
index f72feb9f..81f6b00e 100644
--- a/t/watch_filter_rubylang.t
+++ b/t/watch_filter_rubylang.t
@@ -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();

  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 ` Eric Wong [this message]
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 ` [PATCH 3/3] watch: add per-directory scanning diagnostics Eric Wong

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-2-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).