mirror of
https://github.com/henrywhitaker3/Speedtest-Tracker.git
synced 2025-12-25 14:59:16 +01:00
Moved API run call to queue
Now doesn't take like 60 seconds to run a speedtest from the API. Leaving it standard in the artisan command
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Helpers\SpeedtestHelper;
|
||||
use App\Jobs\SpeedtestJob;
|
||||
use Exception;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
@@ -28,10 +29,10 @@ class SpeedtestController extends Controller
|
||||
public function run()
|
||||
{
|
||||
try {
|
||||
$data = SpeedtestHelper::runSpeedtest();
|
||||
$data = SpeedtestJob::dispatch();
|
||||
return response()->json([
|
||||
'method' => 'run speedtest',
|
||||
'data' => $data
|
||||
'data' => 'a new speedtest has been added to the queue'
|
||||
], 200);
|
||||
} catch(Exception $e) {
|
||||
return response()->json([
|
||||
|
||||
Reference in New Issue
Block a user