Aias00 commented on code in PR #7172:
URL: https://github.com/apache/shenyu/pull/7172#discussion_r4079890383
##########
shenyu-admin/src/main/java/org/apache/shenyu/admin/discovery/DiscoveryDataChangedEventSyncListener.java:
##########
@@ -132,6 +132,9 @@ private void syncData0(final DiscoveryDataChangedEvent
event, final DiscoverySyn
default:
throw new
IllegalStateException("DiscoveryDataChangedEventSyncListener find
IllegalState");
}
+ // Registry events contain individual instances, but gateways consume
a complete snapshot.
+
syncData.setUpstreamDataList(discoveryUpstreamMapper.selectByDiscoveryHandlerId(discoveryHandlerId).stream()
Review Comment:
🟠Non-blocking: this re-queries the DB and republishes the **full** upstream
snapshot on *every* registry event (ADDED/UPDATED/DELETED). Under high instance
churn that's one `selectByDiscoveryHandlerId` + one full payload per individual
change. Correct, and fine at typical scale — just flagging it as the thing to
watch if a registry starts flapping.
##########
shenyu-loadbalancer/src/main/java/org/apache/shenyu/loadbalancer/cache/UpstreamCheckTask.java:
##########
@@ -309,6 +309,17 @@ public void removeFromMap(final Map<String,
List<Upstream>> map, final String se
}
}
+ /**
+ * Run a configuration update atomically with respect to health checks.
+ *
+ * @param action configuration update
+ */
+ void withLock(final Runnable action) {
+ synchronized (lock) {
Review Comment:
🟠Non-blocking: `withLock` serializes *all* config updates
(`submit`/`removeByKey`) with health checks on the shared `lock`. A slow
health-check pass now stalls config propagation until it releases. Reasonable
trade-off for correctness — just be aware of the latency coupling between
health checks and config updates.
--
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]