Copilot commented on code in PR #12680:
URL: https://github.com/apache/cloudstack/pull/12680#discussion_r2839039399
##########
plugins/backup/nas/src/main/java/org/apache/cloudstack/backup/NASBackupProvider.java:
##########
@@ -564,7 +567,14 @@ public Pair<Long, Long> getBackupStorageStats(Long zoneId)
{
@Override
public void syncBackupStorageStats(Long zoneId) {
final List<BackupRepository> repositories =
backupRepositoryDao.listByZoneAndProvider(zoneId, getName());
+ if (CollectionUtils.isEmpty(repositories)) {
+ return;
+ }
Review Comment:
The empty repositories check is placed after the method starts processing
but before the host lookup. If repositories are empty, the host lookup at line
573 becomes unnecessary. Consider moving this check before the host lookup, or
better yet, to the beginning of the method to avoid any unnecessary operations
when there are no repositories to process.
--
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]