Copilot commented on code in PR #1111:
URL: 
https://github.com/apache/skywalking-banyandb/pull/1111#discussion_r3178073581


##########
banyand/liaison/grpc/server.go:
##########
@@ -253,6 +252,19 @@ func NewServer(_ context.Context, tir1Client, tir2Client, 
broadcaster queue.Clie
                protector:           protectorService,
                routeTableProviders: routeProviders,
        }
+       // Phase 2 Step 2.2: wire the cluster-wide AwaitRevisionApplied fan-out.
+       // Tier1 (peer liaisons) and tier2 (data nodes) connection pools are
+       // borrowed via the queue.Client interface added in #1109; the receiving
+       // liaison's name is read from s.curNode, which initCurrentNode 
populates
+       // during PreRun — hence the closure indirection.
+       if cacheProvider != nil {
+               s.barrierSVC = newBarrierServiceCluster(
+                       cacheProvider,
+                       func() queue.Client { return tir1Client },
+                       func() queue.Client { return tir2Client },
+                       func() string { return 
s.curNode.GetMetadata().GetName() },

Review Comment:
   The selfName closure can panic if `s.curNode` is nil (e.g., when 
`common.ContextNodeRolesKey` isn’t set, `initCurrentNode` leaves `curNode` 
unset). This would make `AwaitRevisionApplied` crash the server on first call. 
Consider making the closure nil-safe (return "" when `s.curNode` is nil) and 
let the barrier fan-out handle the empty-self case gracefully.
   



-- 
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