Copilot commented on code in PR #3440:
URL: https://github.com/apache/dubbo-go/pull/3440#discussion_r3426289962
##########
remoting/exchange.go:
##########
@@ -184,6 +184,12 @@ func removePendingResponse(seq SequenceType)
*PendingResponse {
return nil
}
+// RemovePendingResponse removes and returns the pending response for the
given sequence ID.
+// It is the exported version of removePendingResponse for use by external
packages.
+func RemovePendingResponse(seq SequenceType) *PendingResponse {
+ return removePendingResponse(seq)
+}
Review Comment:
Exporting `RemovePendingResponse` expands the public API surface and
effectively commits you to supporting this symbol long-term. If this is only
intended for internal subpackages (like `remoting/getty`), consider
alternatives that avoid exporting (e.g., moving the caller into the same
package, or restructuring packages so this helper remains unexported). If you
do intend this to be public API, consider documenting expected usage/semantics
(e.g., whether callers must also signal/cancel any waiters on the returned
`PendingResponse`).
##########
remoting/getty/listener.go:
##########
@@ -354,6 +354,7 @@ func heartbeat(session getty.Session, timeout
time.Duration, callBack func(err e
select {
case <-gxtime.After(timeout):
err1 = errHeartbeatReadTimeout
+
remoting.RemovePendingResponse(remoting.SequenceType(req.ID))
Review Comment:
This removes the entry from the pending-response map but does not
necessarily unblock any goroutines that might be waiting on the associated
`PendingResponse.Done` (map deletion alone doesn’t signal waiters). If
`PendingResponse.Done` can have waiters beyond the current scope, consider
retrieving the removed `PendingResponse` and completing/canceling it (e.g.,
setting an error and signaling `Done`) to avoid potential goroutine leaks or
indefinite waits.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]