Skip to content

Commit aff9c4f

Browse files
Pipe Worker Output Action Names
1 parent 0a219dc commit aff9c4f

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

workflow-core/src/commonMain/kotlin/com/squareup/workflow1/Sink.kt

+3-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,9 @@ internal suspend fun <
8585
) {
8686
suspendCancellableCoroutine<Unit> { continuation ->
8787
val resumingAction = object : WorkflowAction<PropsT, StateT, OutputT>() {
88-
override fun toString(): String = "sendAndAwaitApplication($action)"
88+
// Pipe through debugging name to the original action.
89+
override val debuggingName: String
90+
get() = action.debuggingName
8991

9092
override fun Updater.apply() {
9193
// Don't execute anything if the caller was cancelled while we were in the queue.

workflow-core/src/commonMain/kotlin/com/squareup/workflow1/WorkerWorkflow.kt

+4-5
Original file line numberDiff line numberDiff line change
@@ -89,13 +89,12 @@ internal suspend fun <OutputT> runWorker(
8989
}
9090

9191
private class EmitWorkerOutputAction<P, S, O>(
92-
private val worker: Worker<*>,
93-
private val renderKey: String,
92+
worker: Worker<*>,
93+
renderKey: String,
9494
private val output: O,
9595
) : WorkflowAction<P, S, O>() {
96-
override val debuggingName: String
97-
get() = CommonKClassTypeNamer.uniqueName(EmitWorkerOutputAction::class) +
98-
"(worker=$worker, key=$renderKey)"
96+
override val debuggingName: String =
97+
"EmitWorkerOutputAction(worker=$worker, key=$renderKey)"
9998

10099
override fun Updater.apply() {
101100
setOutput(output)

workflow-tracing/src/test/resources/com/squareup/workflow1/diagnostic/tracing/expected_trace_file.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@
6060
{"name":"used/free memory","ph":"C","ts":0,"pid":0,"tid":0,"args":{"usedMemory":1,"freeMemory":42}},
6161
{"name":"Snapshot","ph":"B","ts":0,"pid":0,"tid":0,"args":{}},
6262
{"name":"Snapshot","ph":"E","ts":0,"pid":0,"tid":0,"args":{}},
63-
{"name":"Sink received: Worker<String> (2)","cat":"update","ph":"i","ts":0,"pid":0,"tid":0,"s":"t","args":{"action":"sendAndAwaitApplication(action(com.squareup.workflow1.EmitWorkerOutputAction(worker=TypedWorker(java.lang.String (Kotlin reflection is not available)), key=)))"}},
64-
{"name":"WorkflowAction: Worker<String> (2)","cat":"update","ph":"i","ts":0,"pid":0,"tid":0,"s":"p","args":{"action":"sendAndAwaitApplication(action(com.squareup.workflow1.EmitWorkerOutputAction(worker=TypedWorker(java.lang.String (Kotlin reflection is not available)), key=)))","oldState":"0","newState":"{no change}","output":"fired!"}},
63+
{"name":"Sink received: Worker<String> (2)","cat":"update","ph":"i","ts":0,"pid":0,"tid":0,"s":"t","args":{"action":"action(EmitWorkerOutputAction(worker=TypedWorker(java.lang.String (Kotlin reflection is not available)), key=))"}},
64+
{"name":"WorkflowAction: Worker<String> (2)","cat":"update","ph":"i","ts":0,"pid":0,"tid":0,"s":"p","args":{"action":"action(EmitWorkerOutputAction(worker=TypedWorker(java.lang.String (Kotlin reflection is not available)), key=))","oldState":"0","newState":"{no change}","output":"fired!"}},
6565
{"name":"Worker<String> (2)","ph":"O","ts":0,"pid":0,"tid":0,"id":"2","args":{"snapshot":"0"}},
6666
{"name":"Render Pass","cat":"rendering","ph":"B","ts":0,"pid":0,"tid":0,"args":{"props":"3"}},
6767
{"name":"used/free memory","ph":"C","ts":0,"pid":0,"tid":0,"args":{"usedMemory":1,"freeMemory":42}},

0 commit comments

Comments
 (0)