-
Notifications
You must be signed in to change notification settings - Fork 881
fix: derive running ws stop time from deadline #1920
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
fix: derive running ws stop time from deadline #1920
Conversation
Summary: A utility is function is added that answers the question if a workspace is on. Impact: This is a shared piece of logic in workspace scheduling presentations. In particular it unblocks work in 1779, or at least allows an implementation that shares details with the WorkspaceScheduleBanner. Notes: We could possibly instead return whether the workspace is "ON", "UNKNOWN", or "OFF". Maybe a future improvement for that could be made as the neds arrises.
Summary: When a workspace is on, the remaining time until shutdown needs to be derived from the deadline timestamp, not implied from the TTL
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BE ✔️
["delete", "canceled", false], | ||
["delete", "canceling", false], | ||
["delete", "failed", false], | ||
["delete", "pending", false], | ||
["delete", "running", false], | ||
["delete", "succeeded", false], | ||
|
||
["stop", "canceled", false], | ||
["stop", "canceling", false], | ||
["stop", "failed", false], | ||
["stop", "pending", false], | ||
["stop", "running", false], | ||
["stop", "succeeded", false], | ||
|
||
["start", "canceled", false], | ||
["start", "canceling", false], | ||
["start", "failed", false], | ||
["start", "pending", false], | ||
["start", "running", false], | ||
["start", "succeeded", true], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💝
export const isWorkspaceOn = (workspace: Workspace): boolean => { | ||
const transition = workspace.latest_build.transition | ||
const status = workspace.latest_build.job.status | ||
return transition === "start" && status === "succeeded" | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 it's a narrow definition of 'on' but I think that's the correct one.
This resolved #1779 |
* refactor: isWorkspaceOn utility Summary: A utility is function is added that answers the question if a workspace is on. Impact: This is a shared piece of logic in workspace scheduling presentations. In particular it unblocks work in 1779, or at least allows an implementation that shares details with the WorkspaceScheduleBanner. Notes: We could possibly instead return whether the workspace is "ON", "UNKNOWN", or "OFF". Maybe a future improvement for that could be made as the neds arrises. * fix: derive running ws stop time from deadline Summary: When a workspace is on, the remaining time until shutdown needs to be derived from the deadline timestamp, not implied from the TTL
Summary:
When a workspace is on, the remaining time until shutdown needs to be
derived from the deadline timestamp, not implied from the TTL. A utility is
function is added that answers the question if a workspace is on.
Impact:
This is a shared piece of logic in workspace scheduling presentations.
In particular it unblocks work in 1779, or at least allows an
implementation that shares details with the WorkspaceScheduleBanner.
Notes:
We could possibly instead return whether the workspace is "ON",
"UNKNOWN", or "OFF". Maybe a future improvement for that could be made
as the neds arrises.