jason810496 commented on code in PR #69080:
URL: https://github.com/apache/airflow/pull/69080#discussion_r3488984282


##########
java-sdk/sdk/src/main/kotlin/org/apache/airflow/sdk/execution/Comm.kt:
##########
@@ -109,19 +112,22 @@ class CoordinatorComm(
   }
 
   @Throws(ApiError::class)
-  suspend fun communicateImpl(body: Any): Any {
-    var frame: IncomingFrame? = null
+  suspend fun communicateImpl(body: Any): Any =
+    commMutex.withLock {
+      val requestId = nextId.fetchAndAdd(1)
+      var frame: IncomingFrame? = null
 
-    suspend fun handle(f: IncomingFrame) {
-      frame = f
-    }
-    sendMessage(nextId.fetchAndAdd(1), body)
-    processOnce(::handle)
-    if (frame == null) {
-      throw ApiError("No response received")
+      suspend fun handle(f: IncomingFrame) {
+        frame = f
+      }
+      sendMessage(requestId, body)
+      processOnce(::handle)
+      val received = frame ?: throw ApiError("No response received")
+      if (received.id != requestId) {
+        throw ApiError("response id ${received.id} does not match request id 
$requestId")
+      }
+      received.body ?: Unit

Review Comment:
   Yes, the Triggerer and Go-SDK side implemented I/O multiplexing instead of 
fully serializing the requests.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to