Subject: | Invalid state of events after a crash |
When Catalyst is forced to exit (ie. during a crash) during the
execution of an event, the state of the event is set to "running" and
is never reset. Therefore the event will never be run again until the
state file is deleted.
Subject: | scheduler-invalid-state.patch |
Index: lib/Catalyst/Plugin/Scheduler.pm
===================================================================
--- lib/Catalyst/Plugin/Scheduler.pm (revision 451)
+++ lib/Catalyst/Plugin/Scheduler.pm (revision 452)
@@ -157,6 +157,19 @@
$c->config->{scheduler}->{state_file} ||= $c->path_to('scheduler.state');
$c->config->{scheduler}->{hosts_allow} ||= '127.0.0.1';
$c->config->{scheduler}->{yaml_file} ||= $c->path_to('scheduler.yml');
+
+ if (-e $c->config->{scheduler}->{state_file}) {
+ $c->log->debug(
+ sprintf(
+ 'Scheduler: Removing old state file "%s"',
+ $c->config->{scheduler}->{state_file}
+ )
+ )
+ if $c->config->{scheduler}->{logging};
+
+ unlink $c->config->{scheduler}->{state_file}
+ or die("Unable to remove old state file!");
+ }
$c->NEXT::setup(@_);
}