Copilot commented on code in PR #7078:
URL: https://github.com/apache/shenyu/pull/7078#discussion_r4032815502
##########
shenyu-admin/src/main/java/org/apache/shenyu/admin/service/impl/NamespacePluginServiceImpl.java:
##########
@@ -99,7 +99,9 @@ public NamespacePluginVO create(final String namespaceId,
final String pluginId)
PluginDO pluginDO = pluginMapper.selectById(pluginId);
NamespacePluginRelDO namespacePluginRelDO =
NamespacePluginRelDO.buildNamespacePluginRelDO(pluginDO, namespaceId);
namespacePluginRelMapper.insertSelective(namespacePluginRelDO);
- return
namespacePluginRelMapper.selectByPluginIdAndNamespaceId(pluginId, namespaceId);
+ NamespacePluginVO namespacePluginVO =
namespacePluginRelMapper.selectByPluginIdAndNamespaceId(pluginId, namespaceId);
+ namespacePluginEventPublisher.onCreated(namespacePluginVO);
Review Comment:
`insertSelective` returns the affected-row count, but this path publishes
`CREATE` even when that count is `0`, so the gateway/audit stream can announce
a relation that was never persisted (the new test currently exercises this
because an unstubbed Mockito `int` returns `0`). Gate the lookup and event on a
successful insert, as the other admin creators do, and stub a successful insert
in the regression test.
--
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]