Skip to content

Commit 7091e3b

Browse files
committed
fix: immediately mark the workspace as deleting
- workspace status is usually updated every 5 seconds by the polling loop. - that's a bit problematic because when we delete a workspace we have to wait a couple of seconds until we have some visual feedback. - with this patch we force the workspace status to be in "deleting" if the REST api call was succesfull.
1 parent 5cd6e73 commit 7091e3b

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/main/kotlin/com/coder/toolbox/CoderRemoteEnvironment.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,12 @@ class CoderRemoteEnvironment(
165165
context.cs.launch {
166166
try {
167167
client.removeWorkspace(workspace)
168+
// mark the env as deleting otherwise we will have to
169+
// wait for the poller to update the status in the next 5 seconds
170+
state.update {
171+
WorkspaceAndAgentStatus.DELETING.toRemoteEnvironmentState(context)
172+
}
173+
168174
context.cs.launch {
169175
withTimeout(5.minutes) {
170176
var workspaceStillExists = true

0 commit comments

Comments
 (0)