Files
Xboard/app/Console/Commands/SyncServerGfwChecks.php
T
yinjianm 329d52f89f fix(api): 修复墙检测任务超时占用与状态展示
为超过 5 分钟未领取或未上报的 pending/checking
任务自动标记失败,避免长期占用 active 状态并阻塞新检测

同时区分前端“等待节点领取”和“检测中”展示,
补充跳过原因提示,并更新相关测试与文档
2026-04-28 01:44:07 +08:00

33 lines
924 B
PHP

<?php
namespace App\Console\Commands;
use App\Services\ServerGfwCheckService;
use Illuminate\Console\Command;
class SyncServerGfwChecks extends Command
{
protected $signature = 'sync:server-gfw-checks {--limit= : Maximum number of nodes to enqueue}';
protected $description = 'Create automated GFW check tasks for managed parent nodes';
public function handle(ServerGfwCheckService $service): int
{
$limit = $this->option('limit');
$result = $service->startAutomaticChecks(
is_numeric($limit) ? (int) $limit : null
);
$this->info(sprintf(
'Server GFW checks synced: total=%d started=%d skipped=%d active=%d expired=%d',
$result['total'],
count($result['started']),
count($result['skipped']),
$result['active'],
$result['expired'] ?? 0
));
return self::SUCCESS;
}
}