Files
finance/app/Console/Commands/RunAllFetchs.php
T
Ümit Tunç 25327ac0cc Add RunAllFetchs command to execute currency and gold rate fetching jobs sequentially
- Introduced a new console command `RunAllFetchs` to streamline the execution of `FetchCurrencyRates`, `FetchGoldRates`, and `MergeCurrencyAndGoldRates` jobs.
- Implemented synchronous dispatching of jobs with timing results displayed in a table format for performance monitoring.
- This command enhances the application's ability to fetch and merge financial data efficiently in a single execution step.
2025-01-17 23:01:03 +03:00

54 lines
1.3 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use App\Jobs\FetchCurrencyRates;
use App\Jobs\FetchGoldRates;
use App\Jobs\MergeCurrencyAndGoldRates;
class RunAllFetchs extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'run-all-fetchs';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Command description';
/**
* Execute the console command.
*/
public function handle()
{
//
$results = [];
$start = microtime(true);
FetchCurrencyRates::dispatchSync();
$duration = microtime(true) - $start;
$results[] = ['FetchCurrencyRates', number_format($duration, 2)];
$start = microtime(true);
FetchGoldRates::dispatchSync();
$duration = microtime(true) - $start;
$results[] = ['FetchGoldRates', number_format($duration, 2)];
$start = microtime(true);
MergeCurrencyAndGoldRates::dispatchSync();
$duration = microtime(true) - $start;
$results[] = ['MergeCurrencyAndGoldRates', number_format($duration, 2)];
// Tablo formatında yazdırma
$this->table(['İşlem', 'Süre (saniye)'], $results);
}
}