You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
refactor: simplify workspace start status management
Current approach with a secondary poll loop that handles the start action
of a workspace is overengineered. Basically the problem is the CLI takes too
long before moving the workspace into the queued/starting state, during which
the user doesn't have any feedback. To address the issue we:
- stopped the main poll loop from updating the environment
- moved the environment in the queued state immediately after the start button was pushed.
- started a poll loop that moved the workspace from queued state to starting space only
after that state became available in the backend. The intermediary stopped state is skipped by
the secondary poll loop.
@asher pointed out that a better approach can be implemented. We already store the status, and workspace
and the agent in the environment. When the start comes in:
1. We directly update the env. status to "queued"
2. We only change the environment status if there is difference in the existing workspace&agent
status vs the status from the main poll loop
3. no secondary poll loop is needed.
if (wsRawStatus.canStop()) "This will close the workspace and remove all its information, including files, unsaved changes, history, and usage data."
155
+
if (environmentStatus.canStop()) "This will close the workspace and remove all its information, including files, unsaved changes, history, and usage data."
174
156
else"This will remove all information from the workspace, including files, unsaved changes, history, and usage data."
175
157
dialogText +="\n\nType \"${workspace.name}\" below to confirm:"
176
158
177
159
val confirmation = context.ui.showTextInputPopup(
178
-
if (wsRawStatus.canStop()) context.i18n.ptrl("Delete running workspace?") else context.i18n.ptrl("Delete workspace?"),
160
+
if (environmentStatus.canStop()) context.i18n.ptrl("Delete running workspace?") else context.i18n.ptrl(
161
+
"Delete workspace?"
162
+
),
179
163
context.i18n.pnotr(dialogText),
180
164
context.i18n.ptrl("Workspace name"),
181
165
TextType.General,
@@ -264,23 +248,34 @@ class CoderRemoteEnvironment(
264
248
* Update the workspace/agent status to the listeners, if it has changed.
0 commit comments