From 5bde05b66f084c7c9dcf7389079aab6925aef328 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sat, 24 Jun 2017 00:00:04 +0000 Subject: watch: ensure HUP causes the scanner to be reloaded Otherwise the old watcher may run indefinitely --- lib/PublicInbox/WatchMaildir.pm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'lib/PublicInbox/WatchMaildir.pm') diff --git a/lib/PublicInbox/WatchMaildir.pm b/lib/PublicInbox/WatchMaildir.pm index c15e1384..f81a917c 100644 --- a/lib/PublicInbox/WatchMaildir.pm +++ b/lib/PublicInbox/WatchMaildir.pm @@ -179,6 +179,8 @@ sub _try_path { $im->add($mime, $self->{spamcheck}); } +sub quit { $_[0]->{quit} = 1 } + sub watch { my ($self) = @_; my $cb = sub { _try_fsn_paths($self, \@_) }; @@ -188,7 +190,7 @@ sub watch { # in the future... require Filesys::Notify::Simple; my $watcher = Filesys::Notify::Simple->new($mdir); - $watcher->wait($cb) while (1); + $watcher->wait($cb) until ($self->{quit}); } sub scan { -- cgit v1.2.3-24-ge0c7