fix: extend host inventory timeout

dev
admin 1 month ago
parent 77566fc15c
commit fad3b4e4fd

@ -49,6 +49,7 @@
## 生命周期与身份
- daemon 单轮最多检查 10 台启用宿主机,只选择到期宿主机;默认同一宿主机至少间隔 30 秒,可用 `cloud_host_inventory_interval_seconds` 配置为 30~300 秒。到期队列优先选择从未检查或 `health_checked_at` 最旧的宿主机,避免固定低 ID 饥饿,并控制顺序引擎请求对生命周期主循环的占用。
- 每个容量或网络盘点请求的总超时为 8 秒;两次请求仍按顺序执行,任一超时都按完整观测失败处理并保留最后一次有效库存。
- 管理员精确刷新单台宿主机时调用 `CloudHostInventorySyncService::syncOne($hostId)`;它跳过到期窗口,但复用完全相同的 daemon actor、双响应校验、事务和失败标记,不另开宽松路径。
- 管理员保存公网池后不会在写请求内把账本伪装为已同步:配置先保持 `pending`,随后可由上述 daemon 自动盘点,或由“资源调度 → 手动同步”立即触发同一条 `syncOne` 路径。手动同步失败也不会回退或清空最后一次有效容量。
- heartbeat 新增阶段 `host_inventory_sync`,对外错误仅为 `host_inventory_sync_failed` 或 `host_inventory_sync_unconfigured`。

@ -20,7 +20,7 @@ use App\Services\Config;
*/
final class CloudHostInventorySyncService
{
private const ENGINE_TIMEOUT_SECONDS = 3.0;
private const ENGINE_TIMEOUT_SECONDS = 8.0;
private const MAX_HOSTS_PER_PASS = 10;
private const MAX_PUBLIC_POOLS = 32;
private const MAX_PUBLIC_IPS_PER_POOL = 254;

@ -20,6 +20,7 @@ $assert = static function ($condition, string $message): void {
$assert(str_contains($service, "'GET', 'host/capacity'")
&& str_contains($service, "'GET', 'host/network-options'")
&& str_contains($service, 'private const ENGINE_TIMEOUT_SECONDS = 8.0;')
&& str_contains($service, 'public_ip_available_count')
&& str_contains($service, "['available', 'disabled']")
&& str_contains($service, 'self::LOCAL_IP_HOLDS')
@ -34,7 +35,7 @@ $assert(str_contains($service, "'GET', 'host/capacity'")
&& str_contains($service, '$snapshot->last_attempt_at = $attemptedAt;')
&& str_contains($service, "\$host->last_seen_at = \$now;")
&& substr_count($service, "\$host->last_seen_at =") === 1,
'Capacity/IP observation, local-state preservation or last-seen boundary changed.');
'Capacity/IP timeout, observation, local-state preservation or last-seen boundary changed.');
$assert(str_contains($service, 'private const MAX_PUBLIC_POOLS = 32;')
&& str_contains($service, 'private const MAX_PUBLIC_IPS_PER_POOL = 254;')

Loading…
Cancel
Save