Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[prebuilds] Fix stopping and snapshot state #10101

Merged
merged 1 commit into from
May 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,8 @@ class TestPrebuildStateMapper {
},
},
{
name: "failed - no snapshot",
expected: {
state: "failed",
hasError: true,
},
name: "Stopping and no snapshot yet",
expected: undefined,
status: {
id,
phase: WorkspacePhase.STOPPING,
Expand Down
11 changes: 3 additions & 8 deletions components/ws-manager-bridge/src/prebuild-state-mapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,17 +64,12 @@ export class PrebuildStateMapper {
update: {
state: "available",
snapshot: status.conditions!.snapshot,
error: "",
},
};
} else if (!status.conditions!.snapshot) {
// STOPPING && no snapshot? Definitely an error case
return {
type: HeadlessWorkspaceEventType.Failed,
update: {
state: "failed",
error: "error while taking snapshot",
},
};
// STOPPING && no snapshot is an intermediate state that we are choosing to ignore.
return undefined;
} else {
log.error({ instanceId: status.id }, "unhandled prebuild status update", {
phase: status.phase,
Expand Down