Health: do not complain about new jobs...

...that have never been triggered and are not due right now

fixes #1994
This commit is contained in:
Thomas Gelf 2019-10-16 14:47:33 +02:00
parent 8003b7e106
commit 5dab744b81
3 changed files with 9 additions and 1 deletions

View File

@ -32,6 +32,9 @@ next (will be 1.8.0)
### Import and Sync ### Import and Sync
* FIX: Upper- and Lowercase property modifiers are now multibyte/UTF8-safe (#710) * FIX: Upper- and Lowercase property modifiers are now multibyte/UTF8-safe (#710)
### Health Check
* FIX: do not complain about no-due newly created jobs (#1994)
### Background Daemon ### Background Daemon
* FIX: Daemon didn't report DB state to systemd (#1983) * FIX: Daemon didn't report DB state to systemd (#1983)

View File

@ -212,7 +212,7 @@ class Health
$name = $job->get('job_name'); $name = $job->get('job_name');
if ($job->hasBeenDisabled()) { if ($job->hasBeenDisabled()) {
$check->succeed("'$name' has been disabled"); $check->succeed("'$name' has been disabled");
} elseif (! $job->lastAttemptSucceeded()) { } elseif ($job->lastAttemptFailed()) {
$message = $job->get('last_error_message'); $message = $job->get('last_error_message');
$check->fail("Last attempt for '$name' failed: $message"); $check->fail("Last attempt for '$name' failed: $message");
} elseif ($job->isOverdue()) { } elseif ($job->isOverdue()) {

View File

@ -156,6 +156,11 @@ class DirectorJob extends DbObjectWithSettings implements ExportInterface
return $this->get('last_attempt_succeeded') === 'y'; return $this->get('last_attempt_succeeded') === 'y';
} }
public function lastAttemptFailed()
{
return $this->get('last_attempt_succeeded') === 'n';
}
public function hasTimeperiod() public function hasTimeperiod()
{ {
return $this->get('timeperiod_id') !== null; return $this->get('timeperiod_id') !== null;