sureshanaparti commented on code in PR #12409:
URL: https://github.com/apache/cloudstack/pull/12409#discussion_r2767668569


##########
framework/jobs/src/main/java/org/apache/cloudstack/framework/jobs/impl/AsyncJobManagerImpl.java:
##########
@@ -1284,6 +1296,74 @@ private void 
cleanupFailedSnapshotsCreatedWithDefaultStrategy(final long msid) {
         }
     }
 
+    /**
+     * Cleanup networks that are stuck in Implementing state without 
associated async jobs.
+     * This only processes networks that have been stuck for longer than the 
job expiration threshold.
+     */
+    private void cleanupOrphanedNetworks() {
+        try {
+            SearchCriteria<NetworkVO> sc = networkDao.createSearchCriteria();
+            sc.addAnd("state", SearchCriteria.Op.EQ, 
Network.State.Implementing);
+            sc.addAnd("removed", SearchCriteria.Op.NULL);
+            List<NetworkVO> implementingNetworks = networkDao.search(sc, null);
+
+            if (implementingNetworks == null || 
implementingNetworks.isEmpty()) {

Review Comment:
   ```suggestion
               if (CollectionUtils.isEmpty(implementingNetworks)) {
   ```



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