DirectorJob: fix settings, add state helpers

This commit is contained in:
Thomas Gelf 2016-04-22 14:30:52 +02:00
parent 4e0f1da65d
commit cf1e5d88a8
1 changed files with 20 additions and 0 deletions

View File

@ -25,4 +25,24 @@ class DirectorJob extends DbObjectWithSettings
);
protected $settingsTable = 'director_job_setting';
protected $settingsRemoteId = 'job_id';
public function isPending()
{
if ($this->ts_last_attempt === null) {
return true;
}
if (strtotime($this->unixts_last_attempt) + $this->run_interval < time()) {
return true;
}
return false;
}
public function lastAttemptSucceeded()
{
return $this->last_attempt_succeeded === 'y';
}
}