]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/WatchMaildir.pm
watch: ensure HUP causes the scanner to be reloaded
[public-inbox.git] / lib / PublicInbox / WatchMaildir.pm
index c15e138436cd8964e061a40f725212ef425103af..f81a917c5ab74070425a309c3ae3f25a93981fd4 100644 (file)
@@ -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 {