-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
[bridge] Set stoppedTime while workspace is stopping #4833
Conversation
Code-wise this looks ok. But to me this feels like accumulating debt: Why not have a 2nd field called |
9a85cc9
to
8974148
Compare
done |
8974148
to
90fbe59
Compare
/assign @geropl |
/werft run no-preview 👍 started the job as gitpod-build-csweichel-revise-setting-workspace-4818.3 |
Awesome. Will start review now... |
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.
Looks good! IMO there two things missing:
- selecting
stoppingTime
when selecting sessions from the DB - setting
stoppedTime
in bridge
I made the changes here, feel free to cherry-pick.
there's no need to include the time our workspaces take to stop into account when computing workspace runtime (which is accounting relevant).
90fbe59
to
0100bf5
Compare
Thank you @geropl - I've cherry-picked your changes. |
@@ -222,6 +222,7 @@ export class WorkspaceStarter { | |||
// We may have never actually started the workspace which means that ws-manager-bridge never set a workspace status. | |||
// We have to set that status ourselves. | |||
instance.status.phase = 'stopped'; | |||
instance.stoppingTime = new Date().toISOString(); |
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.
Maybe a nit, but: guaranteed stoppingTime == stoppedTime
is a nice thing to have for downstream usage: analytics, bug hunting, ad-hoc DB fixes, etc.
@@ -299,6 +311,7 @@ export class WorkspaceManagerBridge implements Disposable { | |||
|
|||
log.info({instanceId, workspaceId: instance.workspaceId}, "Database says the instance is starting for too long or running, but wsman does not know about it. Marking as stopped in database.", {installation}); | |||
instance.status.phase = "stopped"; | |||
instance.stoppingTime = new Date().toISOString(); |
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.
Maybe a nit, but: guaranteed stoppingTime == stoppedTime
is a nice thing to have for downstream usage: analytics, bug hunting, ad-hoc DB fixes, etc.
I just tested and somehow ended up in a re-start loop 😕 Will investigate. Ok, was missing #4867. Adjusted manually, works now. |
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.
Works as advertised! Feels wholesome to have that column, finally :-D
Happy to fix the nits separately (if at all).
LGTM label has been added. Git tree hash: 564c438d498ff7b96eaa7fceed0323b3463b244f
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: csweichel, geropl The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
there's no need to include the time our workspaces take to stop into account when computing workspace runtime (which is accounting relevant).
fixes #4818