24 lines
709 B
PHP
24 lines
709 B
PHP
<?php
|
|||
|
|
|
||
|
|
namespace App\Console\Commands;
|
||
|
|
|
||
|
|
use App\Services\ColleagueOrderCallbackService;
|
||
|
|
use Illuminate\Console\Command;
|
||
|
|
|
||
|
|
class PollPendingColleagueOrdersCommand extends Command
|
||
|
|
{
|
||
|
|
protected $signature = 'colleague:poll-pending-orders';
|
||
|
|
|
||
|
|
protected $description = 'Poll colleague for pending cover orders every 35s when callback is on';
|
||
|
|
|
||
|
|
public function handle(ColleagueOrderCallbackService $service): int
|
||
|
|
{
|
||
|
|
$first = $service->pollDueOrders();
|
||
|
|
sleep(ColleagueOrderCallbackService::POLL_SECONDS);
|
||
|
|
$second = $service->pollDueOrders();
|
||
|
|
$this->info(json_encode(['first' => $first, 'second' => $second], JSON_UNESCAPED_UNICODE));
|
||
|
|
|
||
|
|
return self::SUCCESS;
|
||
|
|
}
|
||
|
|
}
|