From 89cea6010754963e0dcca8252cbd40c06201f87b Mon Sep 17 00:00:00 2001 From: Vinay Venu Date: Thu, 13 Apr 2023 15:52:09 +0530 Subject: [PATCH] Increased timeout to 60 seconds and made it configurable --- .../BahmniAvniIntegrationApplication.java | 8 ++++++-- integrator/src/main/resources/application.properties | 3 +++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/integrator/src/main/java/org/bahmni_avni_integration/BahmniAvniIntegrationApplication.java b/integrator/src/main/java/org/bahmni_avni_integration/BahmniAvniIntegrationApplication.java index 6f7f3a24..ee32c1dc 100644 --- a/integrator/src/main/java/org/bahmni_avni_integration/BahmniAvniIntegrationApplication.java +++ b/integrator/src/main/java/org/bahmni_avni_integration/BahmniAvniIntegrationApplication.java @@ -1,6 +1,7 @@ package org.bahmni_avni_integration; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.autoconfigure.SpringBootApplication; @@ -16,9 +17,12 @@ public class BahmniAvniIntegrationApplication { private final RestTemplate restTemplate; - @Autowired + @Value("${avni.connectionTimeoutInSeconds}") + private int avniConnectionTimeout; + + @Autowired public BahmniAvniIntegrationApplication(Environment environment, RestTemplateBuilder restTemplateBuilder) { - Duration timeout = Duration.ofSeconds(20); + Duration timeout = Duration.ofSeconds(avniConnectionTimeout); restTemplate = restTemplateBuilder.setConnectTimeout(timeout) .setReadTimeout(timeout) .build(); diff --git a/integrator/src/main/resources/application.properties b/integrator/src/main/resources/application.properties index ad0b3b95..22526f05 100644 --- a/integrator/src/main/resources/application.properties +++ b/integrator/src/main/resources/application.properties @@ -42,6 +42,9 @@ avni.db.name=dummy avni.db.port=4321 avni.impl_org.db.user=dummy avni.impl.user.id=-1 +avni.connectionTimeoutInSeconds=${AVNI_CONNECTION_TIMEOUT:60} + + # Bahmni - OpenMRS openmrs.uri.prefix=${BAHMNI_OPENMRS_API_URL:http://143.110.188.91:8050}