Skip to content

Commit 24e26d0

Browse files
committed
Fetch resources if workspace is off
Turns out resources are not empty for off workspaces, they will have stopped resources, and still not include the agents.
1 parent 597bc72 commit 24e26d0

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/main/kotlin/com/coder/gateway/sdk/CoderRestClient.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,10 @@ open class CoderRestClient(
175175
// It is possible for there to be resources with duplicate names so we
176176
// need to use a set.
177177
return workspaces.flatMap { ws ->
178-
ws.latestBuild.resources.ifEmpty { resources(ws) }.filter { it.agents != null }.flatMap { it.agents!! }.map {
178+
when (ws.latestBuild.status) {
179+
WorkspaceStatus.RUNNING -> ws.latestBuild.resources
180+
else -> resources(ws)
181+
}.filter { it.agents != null }.flatMap { it.agents!! }.map {
179182
ws to it
180183
}
181184
}.toSet()

0 commit comments

Comments
 (0)