diff --git a/src/components/instance/VnicPanel.vue b/src/components/instance/VnicPanel.vue index 3b7d76f..7eec6a8 100644 --- a/src/components/instance/VnicPanel.vue +++ b/src/components/instance/VnicPanel.vue @@ -27,9 +27,15 @@ const emit = defineEmits<{ changed: [] }>() const message = useToast() const vnics = useAsync(() => listVnics(props.cfgId, props.instanceId, props.region)) +/** 附加已受理但 OCI 挂载列表有可见性延迟:限时轮询等新卡入列,入列后交由过渡态轮询接管 */ +const expectAtLeast = ref(0) +let expectUntil = 0 + useTransientPoll( () => vnics.data.value, - (list) => !!list?.some((v) => ATTACHMENT_TRANSIENT_STATES.includes(v.lifecycleState)), + (list) => + !!list?.some((v) => ATTACHMENT_TRANSIENT_STATES.includes(v.lifecycleState)) || + ((list?.length ?? 0) < expectAtLeast.value && Date.now() < expectUntil), () => void vnics.run({ silent: true }), ) @@ -44,6 +50,12 @@ function refresh() { emit('changed') } +function onAttached() { + expectAtLeast.value = (vnics.data.value ?? []).length + 1 + expectUntil = Date.now() + 90_000 + refresh() +} + async function doDetach(attachmentId: string) { detaching.value = attachmentId try { @@ -174,7 +186,7 @@ defineExpose({ refresh: () => vnics.run() })
IPV6 -