Skip to content

Commit a233af0

Browse files
committed
fix incorrect state transition during branch resize
1 parent 8999c91 commit a233af0

1 file changed

Lines changed: 12 additions & 13 deletions

File tree

src/deployment/monitors/resize/__init__.py

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@
4545
RESIZE_STATUS_PRIORITY,
4646
Branch,
4747
BranchResizeStatus,
48-
BranchServiceStatus,
4948
aggregate_resize_statuses,
5049
should_transition_resize_status,
5150
)
@@ -133,20 +132,20 @@ async def _apply_volume_status(
133132

134133

135134
async def set_branch_status(status: BranchResizeStatus, branch: Branch) -> None:
136-
if status == "FAILED":
137-
branch.set_status(BranchServiceStatus.ERROR)
138-
elif status == "COMPLETED":
139-
namespace, _ = get_autoscaler_vm_identity(branch.id)
140-
service_status = await collect_branch_service_health(
141-
namespace,
135+
if status not in {"FAILED", "COMPLETED"}:
136+
return
137+
138+
namespace, _ = get_autoscaler_vm_identity(branch.id)
139+
service_status = await collect_branch_service_health(
140+
namespace,
141+
storage_enabled=branch.enable_file_storage,
142+
)
143+
branch.set_status(
144+
derive_branch_status_from_services(
145+
service_status,
142146
storage_enabled=branch.enable_file_storage,
143147
)
144-
branch.set_status(
145-
derive_branch_status_from_services(
146-
service_status,
147-
storage_enabled=branch.enable_file_storage,
148-
)
149-
)
148+
)
150149

151150

152151
async def _handle_pvc_event(core_v1: CoreV1Api, event: CoreV1Event) -> None:

0 commit comments

Comments
 (0)