GabrielBrascher commented on a change in pull request #3737: Add missing HA 
config keys
URL: https://github.com/apache/cloudstack/pull/3737#discussion_r353499217
 
 

 ##########
 File path: server/src/main/java/com/cloud/ha/HighAvailabilityManagerImpl.java
 ##########
 @@ -846,16 +848,16 @@ public boolean configure(final String name, final 
Map<String, Object> xmlParams)
         _forceHA = Boolean.parseBoolean(value);
 
         value = params.get(TimeToSleep.key());
-        _timeToSleep = (long)NumbersUtil.parseInt(value, 60) * 1000;
+        _timeToSleep = NumbersUtil.parseLong(value, 
parseLong(TimeToSleep.defaultValue())) * 1000;
 
 Review comment:
   I am wondering; why did you use `defaultValue` instead of `value`? The 
default value is not updated when the configuration value changes. You can use 
`TimeToSleep.value()` that will return a Long.
   
   My 2 cents would be to change it into something like:
   ```
   private static final long MILISECONDS_TO_SECONDS_FACTOR = 1000
   
   (...)
   
   _timeToSleep = TimeToSleep.value() * MILISECONDS_TO_SECONDS_FACTOR
   ```
   Same goes with `_maxRetries = MaxRetries.value()` etc.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to