Commit 8b396def authored by Deniro StopCovid's avatar Deniro StopCovid Committed by Redford StopCovid

feat: Use the property var robert.server.request-time-delta-tolerance mapped...

feat: Use the property var robert.server.request-time-delta-tolerance mapped on the env var ROBERT_SERVER_REQUEST_TIME_DELTA_TOLERANCE
parent 472c7adf
...@@ -36,6 +36,7 @@ import org.junit.jupiter.api.Test; ...@@ -36,6 +36,7 @@ import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith; import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.InjectMocks; import org.mockito.InjectMocks;
import org.mockito.Mock; import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.test.context.junit.jupiter.SpringExtension;
import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.core.type.TypeReference;
...@@ -87,6 +88,7 @@ import lombok.Setter; ...@@ -87,6 +88,7 @@ import lombok.Setter;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import test.fr.gouv.stopc.robert.crypto.grpc.server.utils.CryptoTestUtils; import test.fr.gouv.stopc.robert.crypto.grpc.server.utils.CryptoTestUtils;
@Slf4j @Slf4j
@ExtendWith(SpringExtension.class) @ExtendWith(SpringExtension.class)
class CryptoServiceGrpcServerTest { class CryptoServiceGrpcServerTest {
......
...@@ -152,7 +152,7 @@ public class ContactsProcessingConfiguration { ...@@ -152,7 +152,7 @@ public class ContactsProcessingConfiguration {
reader.setTargetType(Registration.class); reader.setTargetType(Registration.class);
reader.setQuery("{}"); reader.setQuery("{exposedEpochs: {$ne: []}}");
return reader; return reader;
} }
......
...@@ -9,12 +9,10 @@ import fr.gouv.stopc.robertserver.database.model.EpochExposition; ...@@ -9,12 +9,10 @@ import fr.gouv.stopc.robertserver.database.model.EpochExposition;
import fr.gouv.stopc.robertserver.database.model.Registration; import fr.gouv.stopc.robertserver.database.model.Registration;
import fr.gouv.stopc.robertserver.database.service.IRegistrationService; import fr.gouv.stopc.robertserver.database.service.IRegistrationService;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.batch.item.ItemProcessor; import org.springframework.batch.item.ItemProcessor;
import java.util.List; import java.util.List;
@Slf4j
@AllArgsConstructor @AllArgsConstructor
public class RegistrationProcessor implements ItemProcessor<Registration, Registration> { public class RegistrationProcessor implements ItemProcessor<Registration, Registration> {
...@@ -36,7 +34,6 @@ public class RegistrationProcessor implements ItemProcessor<Registration, Regist ...@@ -36,7 +34,6 @@ public class RegistrationProcessor implements ItemProcessor<Registration, Regist
this.propertyLoader.getContagiousPeriod(), this.propertyLoader.getContagiousPeriod(),
this.serverConfigurationService.getEpochDurationSecs()); this.serverConfigurationService.getEpochDurationSecs());
log.info("Epoch to keep: {} ", epochsToKeep);
ScoringUtils.updateRegistrationIfRisk( ScoringUtils.updateRegistrationIfRisk(
registration, registration,
epochsToKeep, epochsToKeep,
......
...@@ -35,11 +35,6 @@ public final class ScoringUtils { ...@@ -35,11 +35,6 @@ public final class ScoringUtils {
new ArrayList<>() new ArrayList<>()
: exposedEpochs.stream().filter(epoch -> { : exposedEpochs.stream().filter(epoch -> {
int nbOfEpochsToKeep = (contagiousPeriod * 24 * 3600) / epochDuration; int nbOfEpochsToKeep = (contagiousPeriod * 24 * 3600) / epochDuration;
log.info("currentEpochId ({})- epoch.getEpochId() ({})) <= nbOfEpochsToKeep({}); {} ",
currentEpochId,
epoch.getEpochId(),
nbOfEpochsToKeep,
((currentEpochId - epoch.getEpochId()) <= nbOfEpochsToKeep));
return (currentEpochId - epoch.getEpochId()) <= nbOfEpochsToKeep; return (currentEpochId - epoch.getEpochId()) <= nbOfEpochsToKeep;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
} }
......
...@@ -34,7 +34,6 @@ captcha.magicnumber=fakecaptchamagicnumber ...@@ -34,7 +34,6 @@ captcha.magicnumber=fakecaptchamagicnumber
# Define the durantion limit between Request # Define the durantion limit between Request
robert.esr.limit=1 robert.esr.limit=1
robert.server.country-code=0x21 robert.server.country-code=0x21
robert.server.request-time-delta-tolerance=60 robert.server.request-time-delta-tolerance=60
robert.server.status-request-minimum-epoch-gap=2 robert.server.status-request-minimum-epoch-gap=2
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment