cleanup and amend docker resource limits

This commit is contained in:
Michael Hoennig 2024-08-10 10:01:16 +02:00
parent c136064ff7
commit 286dc4b1a9
3 changed files with 10 additions and 6 deletions

View File

@ -20,8 +20,8 @@ services:
deploy:
resources:
limits:
cpus: '4'
memory: 4G
reservations:
cpus: '2'
memory: 8G
reservations:
cpus: '1'
memory: 2G

View File

@ -5,7 +5,7 @@ import net.hostsharing.hsadminng.mapper.PatchableMapWrapper;
public interface PropertiesProvider {
boolean isLoaded();
PatchableMapWrapper directProps();
PatchableMapWrapper<Object> directProps();
Object getContextValue(final String propName);
default <T> T getDirectValue(final String propName, final Class<T> clazz) {

View File

@ -100,7 +100,6 @@ public abstract class ValidatableProperty<P extends ValidatableProperty<?, ?>, T
public P writeOnly() {
this.writeOnly = true;
optional(); // FIXME: sounds wrong
return self();
}
@ -260,11 +259,16 @@ public abstract class ValidatableProperty<P extends ValidatableProperty<?, ?>, T
}
public void verifyConsistency(final Map.Entry<? extends Enum<?>, ?> typeDef) {
if (required == null && requiresAtLeastOneOf == null && requiresAtMaxOneOf == null && !readOnly && defaultValue == null) {
if (isSpecPotentiallyComplete()) {
throw new IllegalStateException(typeDef.getKey() + "[" + propertyName + "] not fully initialized, please call either .readOnly(), .required(), .optional(), .withDefault(...), .requiresAtLeastOneOf(...) or .requiresAtMaxOneOf(...)" );
}
}
private boolean isSpecPotentiallyComplete() {
return required == null && requiresAtLeastOneOf == null && requiresAtMaxOneOf == null && !readOnly && !writeOnly
&& defaultValue == null;
}
@SuppressWarnings("unchecked")
public T getValue(final Map<String, Object> propValues) {
return (T) Optional.ofNullable(propValues.get(propertyName)).orElse(defaultValue);