RockteMQ-AI commented on code in PR #4202:
URL:
https://github.com/apache/rocketmq-dashboard/pull/4202#discussion_r3970263542
##########
server/src/main/java/org/apache/rocketmq/studio/instance/InstanceService.java:
##########
@@ -639,22 +643,31 @@ public void deleteInstance(Long id) {
removeDataSourceBindings(existing.getName());
recordAudit("DELETE_INSTANCE", "INSTANCE", String.valueOf(id), null,
instanceAuditDetail(existing));
- releaseApacheEndpointAfterCommit(existing);
+ completeInstanceDeletionAfterCommit(existing);
}
- private void releaseApacheEndpointAfterCommit(InstanceVO existing) {
+ private void completeInstanceDeletionAfterCommit(InstanceVO existing) {
if (!TransactionSynchronizationManager.isSynchronizationActive()) {
+ evictDataSourceCache();
releaseApacheEndpointIfUnused(existing, null);
return;
}
TransactionSynchronizationManager.registerSynchronization(new
TransactionSynchronization() {
@Override
public void afterCommit() {
+ evictDataSourceCache();
releaseApacheEndpointIfUnused(existing, null);
Review Comment:
**[Info]** The cache eviction here is correctly placed in `afterCommit()`,
ensuring the cache is only cleared after the deletion is durable. One
consideration: if `releaseApacheEndpointIfUnused` throws, the cache has already
been evicted but the endpoint release is incomplete. Since
`evictDataSourceCache()` is idempotent (clearing an already-empty cache is a
no-op), this ordering is safe — just worth noting for future maintainers.
##########
server/src/main/java/org/apache/rocketmq/studio/settings/SettingsService.java:
##########
@@ -56,6 +56,8 @@
@Service
public class SettingsService {
+ public static final String DATA_SOURCE_CACHE = "data-sources";
Review Comment:
**[Info]** Good extraction of the magic string into a constant. This
prevents the cache-name drift that caused the original bug. Consider also
adding a brief Javadoc on the constant explaining that it must match the
`@Cacheable`/`@CacheEvict` values and that cross-service eviction depends on it.
--
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]