Skip to content

Commit

Permalink
Merge pull request #1241 from square/sedwards/worker-action-naming
Browse files Browse the repository at this point in the history
Pipe Worker Output Action Names
  • Loading branch information
steve-the-edwards authored Dec 13, 2024
2 parents 0a219dc + aff9c4f commit 7a0d51d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,9 @@ internal suspend fun <
) {
suspendCancellableCoroutine<Unit> { continuation ->
val resumingAction = object : WorkflowAction<PropsT, StateT, OutputT>() {
override fun toString(): String = "sendAndAwaitApplication($action)"
// Pipe through debugging name to the original action.
override val debuggingName: String
get() = action.debuggingName

override fun Updater.apply() {
// Don't execute anything if the caller was cancelled while we were in the queue.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,12 @@ internal suspend fun <OutputT> runWorker(
}

private class EmitWorkerOutputAction<P, S, O>(
private val worker: Worker<*>,
private val renderKey: String,
worker: Worker<*>,
renderKey: String,
private val output: O,
) : WorkflowAction<P, S, O>() {
override val debuggingName: String
get() = CommonKClassTypeNamer.uniqueName(EmitWorkerOutputAction::class) +
"(worker=$worker, key=$renderKey)"
override val debuggingName: String =
"EmitWorkerOutputAction(worker=$worker, key=$renderKey)"

override fun Updater.apply() {
setOutput(output)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@
{"name":"used/free memory","ph":"C","ts":0,"pid":0,"tid":0,"args":{"usedMemory":1,"freeMemory":42}},
{"name":"Snapshot","ph":"B","ts":0,"pid":0,"tid":0,"args":{}},
{"name":"Snapshot","ph":"E","ts":0,"pid":0,"tid":0,"args":{}},
{"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=)))"}},
{"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!"}},
{"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=))"}},
{"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!"}},
{"name":"Worker<String> (2)","ph":"O","ts":0,"pid":0,"tid":0,"id":"2","args":{"snapshot":"0"}},
{"name":"Render Pass","cat":"rendering","ph":"B","ts":0,"pid":0,"tid":0,"args":{"props":"3"}},
{"name":"used/free memory","ph":"C","ts":0,"pid":0,"tid":0,"args":{"usedMemory":1,"freeMemory":42}},
Expand Down

0 comments on commit 7a0d51d

Please sign in to comment.