From a1539672716f91acc67397a1a7d16e99df068931 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Wed, 21 Jul 2021 14:07:06 +0000 Subject: lei: auto-refresh watches in config, cancel missing This makes behavior less surprising on restarts as we no longer lose state on restarts, so there's no need to manually run "lei add-watch" to re-enable watches. This also allows us to transparently handle changes if somebody edits the lei config file directly or via git-config(1). --- lib/PublicInbox/DirIdle.pm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'lib/PublicInbox/DirIdle.pm') diff --git a/lib/PublicInbox/DirIdle.pm b/lib/PublicInbox/DirIdle.pm index 7031e5fd..65896f95 100644 --- a/lib/PublicInbox/DirIdle.pm +++ b/lib/PublicInbox/DirIdle.pm @@ -56,10 +56,13 @@ sub new { sub add_watches { my ($self, $dirs, $gone) = @_; my $fl = $MAIL_IN | ($gone ? $MAIL_GONE : 0); + my @ret; for my $d (@$dirs) { - $self->{inot}->watch($d, $fl); + my $w = $self->{inot}->watch($d, $fl) or next; + push @ret, $w; } PublicInbox::FakeInotify::poll_once($self) if !$ino_cls; + @ret } sub rm_watches { -- cgit v1.2.3-24-ge0c7