summaryrefslogtreecommitdiffstats
path: root/lib/private/BackgroundJob/JobList.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/private/BackgroundJob/JobList.php')
-rw-r--r--lib/private/BackgroundJob/JobList.php18
1 files changed, 15 insertions, 3 deletions
diff --git a/lib/private/BackgroundJob/JobList.php b/lib/private/BackgroundJob/JobList.php
index 0de5dfecc8b..b0c580290ed 100644
--- a/lib/private/BackgroundJob/JobList.php
+++ b/lib/private/BackgroundJob/JobList.php
@@ -275,7 +275,7 @@ class JobList implements IJobList {
*
* @param IJob $job
*/
- public function setLastJob($job) {
+ public function setLastJob(IJob $job) {
$this->unlockJob($job);
$this->config->setAppValue('backgroundjob', 'lastjob', $job->getId());
}
@@ -285,7 +285,7 @@ class JobList implements IJobList {
*
* @param IJob $job
*/
- public function unlockJob($job) {
+ public function unlockJob(IJob $job) {
$query = $this->connection->getQueryBuilder();
$query->update('jobs')
->set('reserved_at', $query->expr()->literal(0, IQueryBuilder::PARAM_INT))
@@ -310,11 +310,23 @@ class JobList implements IJobList {
*
* @param IJob $job
*/
- public function setLastRun($job) {
+ public function setLastRun(IJob $job) {
$query = $this->connection->getQueryBuilder();
$query->update('jobs')
->set('last_run', $query->createNamedParameter(time(), IQueryBuilder::PARAM_INT))
->where($query->expr()->eq('id', $query->createNamedParameter($job->getId(), IQueryBuilder::PARAM_INT)));
$query->execute();
}
+
+ /**
+ * @param IJob $job
+ * @param $timeTaken
+ */
+ public function setExecutionTime(IJob $job, $timeTaken) {
+ $query = $this->connection->getQueryBuilder();
+ $query->update('jobs')
+ ->set('execution_duration', $query->createNamedParameter($timeTaken, IQueryBuilder::PARAM_INT))
+ ->where($query->expr()->eq('id', $query->createNamedParameter($job->getId(), IQueryBuilder::PARAM_INT)));
+ $query->execute();
+ }
}