Copilot commented on code in PR #7094:
URL: https://github.com/apache/shenyu/pull/7094#discussion_r4032814668
##########
shenyu-sync-data-center/shenyu-sync-data-websocket/src/main/java/org/apache/shenyu/plugin/sync/data/websocket/handler/AbstractDataHandler.java:
##########
@@ -61,23 +62,22 @@ public abstract class AbstractDataHandler<T> implements
DataHandler {
@Override
public void handle(final String json, final String eventType) {
List<T> dataList = convert(json);
-
- if (CollectionUtils.isEmpty(dataList)) {
- return;
- }
-
DataEventTypeEnum eventTypeEnum =
DataEventTypeEnum.acquireByName(eventType);
switch (eventTypeEnum) {
case REFRESH:
case MYSELF:
- doRefresh(dataList);
+ doRefresh(CollectionUtils.isEmpty(dataList) ?
Collections.emptyList() : dataList);
Review Comment:
Empty snapshots still cannot reach this branch in the production reconnect
path. `SyncDataServiceImpl.syncAllByNamespaceId` publishes empty selector/rule
lists, but `AbstractDataChangedListener.onSelectorChanged` and `onRuleChanged`
return immediately for empty input
(`shenyu-admin/.../AbstractDataChangedListener.java:214-239`); auth exits even
earlier in `AppAuthServiceImpl.syncData` (`:245-248`). Consequently,
reconnecting after the final selector, rule, or auth key is deleted sends no
frame and leaves the stale gateway entries intact. The admin-side snapshot path
must emit an explicit empty event for every refreshed group.
##########
shenyu-sync-data-center/shenyu-sync-data-websocket/src/main/java/org/apache/shenyu/plugin/sync/data/websocket/handler/PluginDataHandler.java:
##########
@@ -41,7 +41,7 @@ public List<PluginData> convert(final String json) {
@Override
protected void doRefresh(final List<PluginData> dataList) {
- pluginDataSubscriber.refreshPluginDataSelf(dataList);
+ pluginDataSubscriber.refreshPluginDataAll();
Review Comment:
This method now invokes `refreshPluginDataAll()`, but the existing
`WebsocketDataHandlerTest.testPluginRefreshExecutor` and
`testPluginMyselfExecutor` still verify `refreshPluginDataSelf(...)` at lines
68 and 76. Both tests will fail in the full websocket module suite; update
those integration-level expectations to the new full-refresh call.
--
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]