2026-01-24 14:03:11 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Console;
|
|
|
|
|
|
|
|
|
|
use Illuminate\Console\Scheduling\Schedule;
|
|
|
|
|
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
|
|
|
|
|
|
|
|
|
|
class Kernel extends ConsoleKernel
|
|
|
|
|
{
|
|
|
|
|
protected $commands = [
|
2026-06-13 17:35:40 +03:30
|
|
|
Commands\Price::class,
|
2026-01-24 14:03:11 +00:00
|
|
|
];
|
2026-06-13 17:35:40 +03:30
|
|
|
|
2026-01-24 14:03:11 +00:00
|
|
|
protected function schedule(Schedule $schedule)
|
|
|
|
|
{
|
2026-06-13 17:35:40 +03:30
|
|
|
// تیک قیمت — هر ۱۰ ثانیه (۶ بار در دقیقه)
|
2026-02-16 09:29:37 +00:00
|
|
|
$schedule->call(function () {
|
2026-06-13 17:35:40 +03:30
|
|
|
for ($i = 0; $i < 6; $i++) {
|
|
|
|
|
\Illuminate\Support\Facades\Artisan::call('prices:tick');
|
|
|
|
|
if ($i < 5) {
|
|
|
|
|
sleep(10);
|
2026-02-16 09:29:37 +00:00
|
|
|
}
|
|
|
|
|
}
|
2026-06-13 17:35:40 +03:30
|
|
|
})->everyMinute()->name('prices_tick_10s')->withoutOverlapping();
|
2026-06-02 12:24:54 +03:30
|
|
|
|
|
|
|
|
$schedule->command('prices:refresh-zaarbox')
|
|
|
|
|
->everyThirtyMinutes()
|
|
|
|
|
->name('refresh_zaarbox_prices')
|
|
|
|
|
->withoutOverlapping();
|
2026-06-13 17:35:40 +03:30
|
|
|
|
|
|
|
|
// پاکسازی و downsample تاریخچه — ساعت ۱۲ شب
|
|
|
|
|
$schedule->command('prices:prune')
|
|
|
|
|
->dailyAt('00:00')
|
|
|
|
|
->name('prune_price_snapshots');
|
2026-01-24 14:03:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected function commands()
|
|
|
|
|
{
|
|
|
|
|
$this->load(__DIR__.'/Commands');
|
|
|
|
|
|
|
|
|
|
require base_path('routes/console.php');
|
|
|
|
|
}
|
|
|
|
|
}
|