From 19655cb200b8d0ecbd217d4c468bbba8d40ce014 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Wed, 22 Nov 2023 01:04:18 +0000 Subject: watch: support `watch=false' to negate watchspam For users hosting read-only mirrors (via clone|fetch) and feeding inboxes via -watch --- lib/PublicInbox/Watch.pm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'lib/PublicInbox') diff --git a/lib/PublicInbox/Watch.pm b/lib/PublicInbox/Watch.pm index 5253ec94..b83a77eb 100644 --- a/lib/PublicInbox/Watch.pm +++ b/lib/PublicInbox/Watch.pm @@ -85,7 +85,10 @@ sub new { $watches = PublicInbox::Config::_array($watches); for my $watch (@$watches) { my $uri; - if (is_maildir($watch)) { + my $bool = $cfg->git_bool($watch); + if (defined $bool && !$bool) { + $ibx->{-watch_disabled} = 1; + } elsif (is_maildir($watch)) { compile_watchheaders($ibx); my ($new, $cur) = ("$watch/new", "$watch/cur"); my $cur_dst = $mdmap{$cur} //= []; @@ -143,6 +146,7 @@ sub _done_for_now { sub remove_eml_i { # each_inbox callback my ($ibx, $self, $eml, $loc) = @_; + return if $ibx->{-watch_disabled}; eval { # try to avoid taking a lock or unnecessary spawning -- cgit v1.2.3-24-ge0c7