Update scheduling in Console Kernel to run FetchCurrencyRates, FetchGoldRates, and MergeCurrencyAndGoldRates jobs every minute
- Changed the scheduling frequency of the FetchCurrencyRates job from hourly to every minute. - Added FetchGoldRates and MergeCurrencyAndGoldRates jobs to the schedule, ensuring they also run every minute. - Introduced a new method `runScheduledCommands` to encapsulate the scheduling logic for better organization and maintainability. This commit enhances the application's ability to fetch and merge financial data in a timely manner.
This commit is contained in:
+17
-1
@@ -5,6 +5,8 @@ namespace App\Console;
|
|||||||
use Illuminate\Console\Scheduling\Schedule;
|
use Illuminate\Console\Scheduling\Schedule;
|
||||||
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
|
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
|
||||||
use App\Jobs\FetchCurrencyRates;
|
use App\Jobs\FetchCurrencyRates;
|
||||||
|
use App\Jobs\FetchGoldRates;
|
||||||
|
use App\Jobs\MergeCurrencyAndGoldRates;
|
||||||
|
|
||||||
class Kernel extends ConsoleKernel
|
class Kernel extends ConsoleKernel
|
||||||
{
|
{
|
||||||
@@ -18,7 +20,9 @@ class Kernel extends ConsoleKernel
|
|||||||
*/
|
*/
|
||||||
protected function schedule(Schedule $schedule)
|
protected function schedule(Schedule $schedule)
|
||||||
{
|
{
|
||||||
$schedule->job(new FetchCurrencyRates())->hourly();
|
$schedule->job(new FetchCurrencyRates())->everyMinute();
|
||||||
|
$schedule->job(new FetchGoldRates())->everyMinute();
|
||||||
|
$schedule->job(new MergeCurrencyAndGoldRates())->everyMinute();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -32,4 +36,16 @@ class Kernel extends ConsoleKernel
|
|||||||
|
|
||||||
require base_path('routes/console.php');
|
require base_path('routes/console.php');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function runScheduledCommands()
|
||||||
|
{
|
||||||
|
$schedule = app(Schedule::class);
|
||||||
|
$schedule->job(new FetchCurrencyRates())->everyMinute();
|
||||||
|
$schedule->job(new FetchGoldRates())->everyMinute();
|
||||||
|
$schedule->job(new MergeCurrencyAndGoldRates())->everyMinute();
|
||||||
|
|
||||||
|
// Diğer job'larınızı buraya ekleyin
|
||||||
|
|
||||||
|
$schedule->run();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user