Copilot commented on code in PR #12421:
URL: https://github.com/apache/cloudstack/pull/12421#discussion_r2689770599


##########
server/src/main/java/com/cloud/alert/AlertManagerImpl.java:
##########
@@ -294,13 +294,8 @@ protected void recalculateHostCapacities() {
                 Math.min(CapacityManager.CapacityCalculateWorkers.value(), 
hostIds.size())));
         for (Long hostId : hostIds) {
             futures.put(hostId, executorService.submit(() -> {
-                Transaction.execute(new TransactionCallbackNoReturn() {
-                    @Override
-                    public void doInTransactionWithoutResult(TransactionStatus 
status) {
-                        final HostVO host = hostDao.findById(hostId);
-                        _capacityMgr.updateCapacityForHost(host);
-                    }
-                });
+                final HostVO host = hostDao.findById(hostId);
+                _capacityMgr.updateCapacityForHost(host);

Review Comment:
   The change correctly removes the redundant Transaction.execute wrapper. 
However, there's an inconsistency with `recalculateStorageCapacities()` (lines 
313-347) which still uses Transaction.execute wrapper. For consistency and to 
prevent similar nested transaction issues, consider applying the same pattern 
if the methods called within have their own transaction management (e.g., if 
they use @DB annotation or Transaction.execute internally).



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