khanegi setting and prices records
This commit is contained in:
+13
-19
@@ -2,44 +2,38 @@
|
||||
|
||||
namespace App\Console;
|
||||
|
||||
use App\Console\Commands\Price;
|
||||
use Illuminate\Console\Scheduling\Schedule;
|
||||
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
|
||||
|
||||
class Kernel extends ConsoleKernel
|
||||
{
|
||||
protected $commands = [
|
||||
Price::class,
|
||||
Commands\Price::class,
|
||||
];
|
||||
/**
|
||||
* Define the application's command schedule.
|
||||
*
|
||||
* @param \Illuminate\Console\Scheduling\Schedule $schedule
|
||||
* @return void
|
||||
*/
|
||||
|
||||
protected function schedule(Schedule $schedule)
|
||||
{
|
||||
// همگامسازی قیمت محصولات متغیر (reading_method) — هر ۳۰ ثانیه
|
||||
// تیک قیمت — هر ۱۰ ثانیه (۶ بار در دقیقه)
|
||||
$schedule->call(function () {
|
||||
for ($i = 0; $i < 2; $i++) {
|
||||
\Illuminate\Support\Facades\Artisan::call('product:sync-prices');
|
||||
if ($i < 1) {
|
||||
sleep(30);
|
||||
for ($i = 0; $i < 6; $i++) {
|
||||
\Illuminate\Support\Facades\Artisan::call('prices:tick');
|
||||
if ($i < 5) {
|
||||
sleep(10);
|
||||
}
|
||||
}
|
||||
})->everyMinute()->name('sync_product_prices_30s')->withoutOverlapping();
|
||||
})->everyMinute()->name('prices_tick_10s')->withoutOverlapping();
|
||||
|
||||
$schedule->command('prices:refresh-zaarbox')
|
||||
->everyThirtyMinutes()
|
||||
->name('refresh_zaarbox_prices')
|
||||
->withoutOverlapping();
|
||||
|
||||
// پاکسازی و downsample تاریخچه — ساعت ۱۲ شب
|
||||
$schedule->command('prices:prune')
|
||||
->dailyAt('00:00')
|
||||
->name('prune_price_snapshots');
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the commands for the application.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function commands()
|
||||
{
|
||||
$this->load(__DIR__.'/Commands');
|
||||
|
||||
Reference in New Issue
Block a user