- Added new protected method getOldestJob to JQW_Controller

- Added new public method getOldestJob to JobsQueueLib
This commit is contained in:
Paolo
2021-02-16 21:21:11 +01:00
parent fec8fbb6d4
commit 94d335600c
2 changed files with 26 additions and 0 deletions
+13
View File
@@ -56,6 +56,19 @@ class JobsQueueLib
return $this->_ci->JobsQueueModel->loadWhere(array('status' => self::STATUS_NEW, 'type' => $type));
}
/**
* To get the oldest added jobs using the given job type
*/
public function getOldestJob($type)
{
$this->_ci->JobsQueueModel->resetQuery();
$this->_ci->JobsQueueModel->addOrder('creationtime', 'ASC');
$this->_ci->JobsQueueModel->addLimit('1');
return $this->_ci->JobsQueueModel->loadWhere(array('status' => self::STATUS_NEW, 'type' => $type));
}
/**
* To get all the jobs specified by the given parameters
*/