From 3d269c02618d4ebf92fa691dbd70327850b105aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=9Cmit=20Tun=C3=A7?= Date: Fri, 17 Jan 2025 23:00:53 +0300 Subject: [PATCH] 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. --- app/Console/Kernel.php | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php index 45aa948..6b5345d 100644 --- a/app/Console/Kernel.php +++ b/app/Console/Kernel.php @@ -5,6 +5,8 @@ namespace App\Console; use Illuminate\Console\Scheduling\Schedule; use Illuminate\Foundation\Console\Kernel as ConsoleKernel; use App\Jobs\FetchCurrencyRates; +use App\Jobs\FetchGoldRates; +use App\Jobs\MergeCurrencyAndGoldRates; class Kernel extends ConsoleKernel { @@ -18,7 +20,9 @@ class Kernel extends ConsoleKernel */ 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'); } + + 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(); + } } \ No newline at end of file