restart worker after two days if splay restart did not trigger

This commit is contained in:
Oliver Gorwits
2014-11-19 12:52:40 +00:00
parent a8208121c2
commit a8d63ff4af

View File

@@ -42,13 +42,14 @@ sub worker_body {
$self->close_job($job);
# restart worker once a day.
# relies on the worker seeing a job at least every hour.
my $hour = [localtime()]->[2];
if ($wid and (time >= ($self->{started} + 86400))
and ($hour == ($wid % 24))) {
if ($wid) {
if ((time >= ($self->{started} + 86400) and $hour == ($wid % 24))
or (time > ($self->{started} + 172800))) {
$self->exit(0, "recycling worker $wid");
}
}
}
}
sub close_job {