Fix default configuratiton in MonitoredS3ObjectConfiguration

This commit is contained in:
Ravi Khadiwala 2024-01-08 14:39:18 -06:00 committed by ravi-signal
parent b6ecfc7131
commit f66566aa17
1 changed files with 11 additions and 9 deletions

View File

@ -5,8 +5,6 @@
package org.whispersystems.textsecuregcm.configuration; package org.whispersystems.textsecuregcm.configuration;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.common.annotations.VisibleForTesting;
import java.time.Duration; import java.time.Duration;
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
@ -14,14 +12,18 @@ public record MonitoredS3ObjectConfiguration(
@NotBlank String s3Region, @NotBlank String s3Region,
@NotBlank String s3Bucket, @NotBlank String s3Bucket,
@NotBlank String objectKey, @NotBlank String objectKey,
long maxSize, Long maxSize,
Duration refreshInterval Duration refreshInterval) {
) {
static long DEFAULT_MAXSIZE = 16*1024*1024; private static long DEFAULT_MAXSIZE = 16*1024*1024;
static Duration DEFAULT_DURATION = Duration.ofMinutes(5); private static Duration DEFAULT_REFRESH_INTERVAL = Duration.ofMinutes(5);
public MonitoredS3ObjectConfiguration(String s3Region, String s3Bucket, String objectKey) { public MonitoredS3ObjectConfiguration {
this(s3Region, s3Bucket, objectKey, DEFAULT_MAXSIZE, DEFAULT_DURATION); if (maxSize == null) {
maxSize = DEFAULT_MAXSIZE;
}
if (refreshInterval == null) {
refreshInterval = DEFAULT_REFRESH_INTERVAL;
}
} }
} }