From 6a838715d3f5b5cb82a9834b5bbeec88e8d38200 Mon Sep 17 00:00:00 2001 From: "EPAM\\Felipe_Hernandez" Date: Tue, 27 Feb 2024 10:45:57 -0500 Subject: [PATCH 1/3] feat: put 30 seconds as default client time out --- api/utils/validator.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/api/utils/validator.go b/api/utils/validator.go index 81a783d..c942689 100644 --- a/api/utils/validator.go +++ b/api/utils/validator.go @@ -16,7 +16,7 @@ type UserInputValidaton struct { ClientId string `validate:"required,min=36,max=36"` ClientSecret string `validate:"required,min=36,max=64"` ApiUrl string `validate:"required,http_url"` - ClientTimeOutinSeconds int `validate:"gte=1,lte=301"` + ClientTimeOutinSeconds int `validate:"gte=1,lte=300"` Separator string `validate:"required,min=1,max=1"` VerifyCa bool `validate:"required"` } @@ -26,6 +26,10 @@ var validate *validator.Validate // ValidateInputs is responsible for validating end-user inputs. func ValidateInputs(clientId string, clientSecret string, apiUrl string, clientTimeOutinSeconds int, separator *string, verifyCa bool, logger logging.Logger, certificate string, certificate_key string) error { + if clientTimeOutinSeconds == 0 { + clientTimeOutinSeconds = 30 + } + validate = validator.New(validator.WithRequiredStructEnabled()) userInput := &UserInputValidaton{ From 69b20db73857d5fef01e5e1d9db5e95509ecab51 Mon Sep 17 00:00:00 2001 From: "EPAM\\Felipe_Hernandez" Date: Tue, 27 Feb 2024 11:47:22 -0500 Subject: [PATCH 2/3] feat: put 30 seconds as default client time out --- TestClient.go | 2 +- api/utils/validator.go | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/TestClient.go b/TestClient.go index 8cad762..98e8d66 100644 --- a/TestClient.go +++ b/TestClient.go @@ -33,7 +33,7 @@ func main() { retryMaxElapsedTimeMinutes := 2 // validate inputs - errorsInInputs := utils.ValidateInputs(clientId, clientSecret, apiUrl, clientTimeOutInSeconds, &separator, verifyCa, zapLogger, certificate, certificateKey) + errorsInInputs := utils.ValidateInputs(clientId, clientSecret, apiUrl, clientTimeOutInSeconds, &separator, verifyCa, zapLogger, certificate, certificateKey, &retryMaxElapsedTimeMinutes) if errorsInInputs != nil { return diff --git a/api/utils/validator.go b/api/utils/validator.go index c942689..69f3875 100644 --- a/api/utils/validator.go +++ b/api/utils/validator.go @@ -24,10 +24,12 @@ type UserInputValidaton struct { var validate *validator.Validate // ValidateInputs is responsible for validating end-user inputs. -func ValidateInputs(clientId string, clientSecret string, apiUrl string, clientTimeOutinSeconds int, separator *string, verifyCa bool, logger logging.Logger, certificate string, certificate_key string) error { +func ValidateInputs(clientId string, clientSecret string, apiUrl string, clientTimeOutinSeconds int, separator *string, verifyCa bool, logger logging.Logger, certificate string, certificate_key string, retryMaxElapsedTimeMinutes *int) error { if clientTimeOutinSeconds == 0 { clientTimeOutinSeconds = 30 + *retryMaxElapsedTimeMinutes = 2 + } validate = validator.New(validator.WithRequiredStructEnabled()) From 932117d6197bc6aa42b1cf1922ad0f86b9b52192 Mon Sep 17 00:00:00 2001 From: "EPAM\\Felipe_Hernandez" Date: Tue, 27 Feb 2024 14:51:28 -0500 Subject: [PATCH 3/3] feat: put 30 seconds as default client time out --- api/utils/validator.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/api/utils/validator.go b/api/utils/validator.go index 69f3875..c7443c2 100644 --- a/api/utils/validator.go +++ b/api/utils/validator.go @@ -32,6 +32,10 @@ func ValidateInputs(clientId string, clientSecret string, apiUrl string, clientT } + if *retryMaxElapsedTimeMinutes == 0 { + *retryMaxElapsedTimeMinutes = 2 + } + validate = validator.New(validator.WithRequiredStructEnabled()) userInput := &UserInputValidaton{