Improve background workers
This commit is contained in:
43
app/Job/HttpAsyncJob.php
Normal file
43
app/Job/HttpAsyncJob.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace Kanboard\Job;
|
||||
|
||||
/**
|
||||
* Async HTTP Client (fire and forget)
|
||||
*
|
||||
* @package Kanboard\Job
|
||||
* @author Frederic Guillot
|
||||
*/
|
||||
class HttpAsyncJob extends BaseJob
|
||||
{
|
||||
/**
|
||||
* Set job parameters
|
||||
*
|
||||
* @access public
|
||||
* @param string $method
|
||||
* @param string $url
|
||||
* @param string $content
|
||||
* @param array $headers
|
||||
* @return $this
|
||||
*/
|
||||
public function withParams($method, $url, $content, array $headers)
|
||||
{
|
||||
$this->jobParams = array($method, $url, $content, $headers);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set job parameters
|
||||
*
|
||||
* @access public
|
||||
* @param string $method
|
||||
* @param string $url
|
||||
* @param string $content
|
||||
* @param array $headers
|
||||
* @return $this
|
||||
*/
|
||||
public function execute($method, $url, $content, array $headers)
|
||||
{
|
||||
$this->httpClient->doRequest($method, $url, $content, $headers);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user