Open
Description
It's a generic issue please ally it wherever it is applicable, a few examples are given below
Description:
In the existing code, we have a hardcoded value "10" used for retry attempts. To improve code maintainability, we should replace this value read it from a property.
Similarly for the second example use a constant class (do-not create a new if it exists) and read the value from it
Example Code details
class name:
src/main/java/io/spaship/operator/service/k8s/Operator.java
existing code 1
.onFailure()
.retry()
.withBackOff(Duration.ofSeconds(1), Duration.ofSeconds(2))
.atMost(10)
existing code 2
public ConfigMap updateConfigMap(Environment environment, Object syncConfig) {
var configMapName = "sidecar-config-"
Benefits:
- Enhanced code maintainability.
- Improved flexibility in handling retry attempts.
Implementation:
- Replace the hardcoded value "10" with property reading .
- Replace the hardcoded value "sidecar-config-" with a constant .