Skip to content

Commit 3997712

Browse files
committed
chore: partially revert previous comment
Seems like we can't properly get the coroutine name from a Job. The name of the coroutine is not super friendly but still workable with the new logs.
1 parent 6aa83fd commit 3997712

File tree

3 files changed

+5
-38
lines changed

3 files changed

+5
-38
lines changed

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

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ import com.coder.toolbox.sdk.ex.APIResponseException
77
import com.coder.toolbox.sdk.v2.models.WorkspaceStatus
88
import com.coder.toolbox.util.CoderProtocolHandler
99
import com.coder.toolbox.util.DialogUi
10-
import com.coder.toolbox.util.friendlyName
11-
import com.coder.toolbox.util.name
1210
import com.coder.toolbox.util.toURL
1311
import com.coder.toolbox.util.waitForTrue
1412
import com.coder.toolbox.util.withPath
@@ -91,7 +89,7 @@ class CoderRemoteProvider(
9189
* first time).
9290
*/
9391
private fun poll(client: CoderRestClient, cli: CoderCLIManager): Job =
94-
context.cs.launch(CoroutineName("Workspace Poller - ${friendlyName()}")) {
92+
context.cs.launch(CoroutineName("Workspace Poller")) {
9593
var lastPollTime = TimeSource.Monotonic.markNow()
9694
while (isActive) {
9795
try {
@@ -246,7 +244,7 @@ class CoderRemoteProvider(
246244
override fun close() {
247245
pollJob?.let {
248246
it.cancel()
249-
context.logger.info("Cancelled workspace poll job ${pollJob.name()}")
247+
context.logger.info("Cancelled workspace poll job ${pollJob.toString()}")
250248
}
251249
client?.close()
252250
lastEnvironments.clear()
@@ -332,7 +330,7 @@ class CoderRemoteProvider(
332330

333331
environments.showLoadingMessage()
334332
pollJob = poll(restClient, cli)
335-
context.logger.info("Workspace poll job with name ${pollJob.name()} was created while handling URI $uri")
333+
context.logger.info("Workspace poll job with name ${pollJob.toString()} was created while handling URI $uri")
336334
isInitialized.waitForTrue()
337335
}
338336
} catch (ex: Exception) {
@@ -412,13 +410,13 @@ class CoderRemoteProvider(
412410
this.client = client
413411
pollJob?.let {
414412
it.cancel()
415-
context.logger.info("Cancelled workspace poll job ${pollJob.name()} in order to start a new one")
413+
context.logger.info("Cancelled workspace poll job ${pollJob.toString()} in order to start a new one")
416414
}
417415
environments.showLoadingMessage()
418416
coderHeaderPage.setTitle(context.i18n.pnotr(client.url.toString()))
419417
context.logger.info("Displaying ${client.url} in the UI")
420418
pollJob = poll(client, cli)
421-
context.logger.info("Workspace poll job with name ${pollJob.name()} was created")
419+
context.logger.info("Workspace poll job with name ${pollJob.toString()} was created")
422420
}
423421

424422
private fun MutableStateFlow<LoadableState<List<CoderRemoteEnvironment>>>.showLoadingMessage() {

src/main/kotlin/com/coder/toolbox/util/CoroutineExtensions.kt

Lines changed: 0 additions & 6 deletions
This file was deleted.

src/main/kotlin/com/coder/toolbox/util/NameGenerator.kt

Lines changed: 0 additions & 25 deletions
This file was deleted.

0 commit comments

Comments
 (0)