summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
f9b70eb)
This should be more reliable and safer as it'll ensure
existing fast-import instances are shut down properly.
$im->add($mime, $self->{spamcheck});
}
$im->add($mime, $self->{spamcheck});
}
-sub quit { $_[0]->{quit} = 1 }
+sub quit { trigger_scan($_[0], 'quit') }
sub watch {
my ($self) = @_;
sub watch {
my ($self) = @_;
# in the future...
require Filesys::Notify::Simple;
my $fsn = Filesys::Notify::Simple->new([@{$self->{mdir}}, $scandir]);
# in the future...
require Filesys::Notify::Simple;
my $fsn = Filesys::Notify::Simple->new([@{$self->{mdir}}, $scandir]);
- $fsn->wait($cb) until ($self->{quit});
+ $fsn->wait($cb) until $self->{quit};
sub scan {
my ($self, $path) = @_;
sub scan {
my ($self, $path) = @_;
+ if ($path =~ /quit\z/) {
+ %{$self->{opendirs}} = ();
+ _done_for_now($self);
+ $self->{quit} = 1;
+ return;
+ }
+ # else: $path =~ /(cont|full)\z/
+ return if $self->{quit};
my $max = 10;
my $opendirs = $self->{opendirs};
my @dirnames = keys %$opendirs;
my $max = 10;
my $opendirs = $self->{opendirs};
my @dirnames = keys %$opendirs;
$SIG{HUP} = $reload;
$SIG{USR1} = $scan;
$SIG{ALRM} = sub { $SIG{ALRM} = 'DEFAULT'; $scan->() };
$SIG{HUP} = $reload;
$SIG{USR1} = $scan;
$SIG{ALRM} = sub { $SIG{ALRM} = 'DEFAULT'; $scan->() };
+ $SIG{QUIT} = $SIG{TERM} = $SIG{INT} = sub {
+ $watch_md->quit if $watch_md;
+ $watch_md = undef;
+ };
alarm(1);
$watch_md->watch while ($watch_md);
}
alarm(1);
$watch_md->watch while ($watch_md);
}