fix price force refresh 2
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Services\LivePriceTickService;
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
/**
|
||||
* هر دقیقه ۶ بار prices:tick — برای schedule:run (فاصله ۱۰ ثانیه).
|
||||
*/
|
||||
class PriceTickLoopCommand extends Command
|
||||
{
|
||||
protected $signature = 'prices:tick-loop {--iterations=6} {--interval=10}';
|
||||
|
||||
protected $description = 'Run prices:tick several times per minute (default: 6× every 10s)';
|
||||
|
||||
public function handle(LivePriceTickService $tickService): int
|
||||
{
|
||||
$iterations = max(1, (int) $this->option('iterations'));
|
||||
$interval = max(1, (int) $this->option('interval'));
|
||||
|
||||
for ($i = 0; $i < $iterations; $i++) {
|
||||
$tickService->tick();
|
||||
|
||||
if ($i < $iterations - 1) {
|
||||
sleep($interval);
|
||||
}
|
||||
}
|
||||
|
||||
return self::SUCCESS;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user