Skip to content

Commit 199cbbc

Browse files
committed
fixup! Convert branch state management to jobs
1 parent e7891c8 commit 199cbbc

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

src/api/organization/project/branch/control_tasks.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,14 @@ async def _async_perform_control(branch_id: str, action: str) -> dict:
8080
desired_phases = _DESIRED_PHASES[action]
8181
elapsed = 0.0
8282
while True:
83-
vm = await get_neon_vm(namespace, name)
84-
if vm.status is not None and vm.status.phase in desired_phases:
85-
break
83+
try:
84+
vm = await get_neon_vm(namespace, name)
85+
if vm.status is not None and vm.status.phase in desired_phases:
86+
break
87+
except RuntimeError:
88+
# VM resource may be transiently absent (404) while NeonVM
89+
# reconciles the power-state change; keep polling.
90+
logger.debug("VM %r transiently unavailable during %r, retrying", name, action)
8691
if elapsed >= _TIMEOUT_SEC:
8792
raise TimeoutError(f"VM {name!r} did not reach {desired_phases} within {_TIMEOUT_SEC}s")
8893
await asyncio.sleep(_POLL_INTERVAL_SEC)

0 commit comments

Comments
 (0)