Skip to content

Commit 6bac0f4

Browse files
committed
Merge pull request #49 from carcabot/master
Priority, Delay , TTR Job
2 parents 0fdb44d + 51ec5c9 commit 6bac0f4

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

demo/queues/BeanstalkSampleQueue.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ public function __construct()
1919
);
2020
}
2121

22-
public function addJob($newJob = null)
22+
public function addJob($newJob = null, $DEFAULT_PRIORITY=1024, $DEFAULT_DELAY=0, $DEFAULT_TTR=60)
2323
{
2424
$formatted_data = array('worker'=>$this->queueWorker, 'data'=>$newJob);
25-
$this->dataSource->add($formatted_data);
25+
$this->dataSource->add($formatted_data, $DEFAULT_PRIORITY, $DEFAULT_DELAY, $DEFAULT_TTR);
2626

2727
return true;
2828
}

src/PHPQueue/Backend/Beanstalkd.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,20 +34,20 @@ public function connect()
3434
* @param array $data
3535
* @return boolean Status of saving
3636
*/
37-
public function add($data=array())
37+
public function add($data=array(), $DEFAULT_PRIORITY=1024, $DEFAULT_DELAY=0, $DEFAULT_TTR=60)
3838
{
39-
$this->push($data);
39+
$this->push($data, $DEFAULT_PRIORITY, $DEFAULT_DELAY, $DEFAULT_TTR);
4040
return true;
4141
}
4242

4343
/**
4444
* @param array $data
4545
* @return integer Primary ID of the new record.
4646
*/
47-
public function push($data)
47+
public function push($data, $DEFAULT_PRIORITY=1024, $DEFAULT_DELAY=0, $DEFAULT_TTR=60)
4848
{
4949
$this->beforeAdd();
50-
$response = $this->getConnection()->useTube($this->tube)->put(json_encode($data));
50+
$response = $this->getConnection()->useTube($this->tube)->put(json_encode($data), $DEFAULT_PRIORITY, $DEFAULT_DELAY, $DEFAULT_TTR);
5151
if (!$response) {
5252
throw new BackendException("Unable to save job.");
5353
}

0 commit comments

Comments
 (0)