Copilot commented on code in PR #11256:
URL: https://github.com/apache/cloudstack/pull/11256#discussion_r2221860168
##########
server/src/main/java/com/cloud/network/NetworkServiceImpl.java:
##########
@@ -907,7 +907,7 @@ public NicSecondaryIp allocateSecondaryGuestIP(final long
nicId, IpAddresses req
throw new InvalidParameterValueException("Invalid network id is
given");
}
- int maxAllowedIpsPerNic =
NumbersUtil.parseInt(_configDao.getValue(Config.MaxNumberOfSecondaryIPsPerNIC.key()),
10);
+ int maxAllowedIpsPerNic =
NumbersUtil.parseInt(_configDao.getValue(Config.MaxNumberOfSecondaryIPsPerNIC.key()),
Integer.parseInt(Config.MaxNumberOfSecondaryIPsPerNIC.getDefaultValue()));
Review Comment:
The Integer.parseInt(Config.MaxNumberOfSecondaryIPsPerNIC.getDefaultValue())
call is executed on every method invocation. Consider caching this value or
using a static final field since the default value doesn't change at runtime.
```suggestion
int maxAllowedIpsPerNic = MAX_ALLOWED_IPS_PER_NIC;
```
--
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]