mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-23 22:44:03 +00:00
Code sync from Shipping Portal, independent deployment of Vue Polling, Performance Improvement and tweaking for better user experience
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Jobs\Processors;
|
||||
|
||||
use App\Classes\Modules\Jobs\Services\FetchesJobResult;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class FetchesJobResultProcessor
|
||||
{
|
||||
/** @var FetchesJobResult */
|
||||
private $fetchesJobResult;
|
||||
|
||||
|
||||
/**
|
||||
* FetchesJobResultProcessor constructor.
|
||||
* @param FetchesJobResult $fetchesJobResult
|
||||
*/
|
||||
public function __construct(FetchesJobResult $fetchesJobResult)
|
||||
{
|
||||
$this->fetchesJobResult = $fetchesJobResult;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @return Model
|
||||
* @throws \App\Classes\Exceptions\MalformedRequestException
|
||||
* @throws \App\Classes\Exceptions\JobResourceNotFoundException
|
||||
* @throws \App\Classes\Exceptions\ResourceNotFoundException
|
||||
*/
|
||||
public function execute(Request $request){
|
||||
|
||||
$res1 = $this->fetchesJobResult->execute(['job_id' => $request->route('job_id')]);
|
||||
|
||||
if(!$res1->result){
|
||||
Log::info('Job id: '.$request->route('job_id'));
|
||||
$res2 = $this->fetchesJobResult->execute(['request_signature' => $res1->request_signature, 'result_not_null' => true, 'order_by_id_desc' => true]);
|
||||
Log::info('Job id: '.$res2->id." , request_signature: ".$res2->request_signature);
|
||||
return $res2;
|
||||
}
|
||||
|
||||
return $res1;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user