From 7befb4d786cf6020dda0ad195d9a3772c17d35b2 Mon Sep 17 00:00:00 2001 From: Casey Waldren Date: Mon, 13 May 2024 11:21:29 -0700 Subject: [PATCH 1/2] fix: furthur improvements to high timeout log msg --- ldclient.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ldclient.go b/ldclient.go index be7aec28..436a9753 100644 --- a/ldclient.go +++ b/ldclient.go @@ -35,7 +35,7 @@ import ( const Version = internal.SDKVersion // highWaitForSeconds is the initialization wait time threshold that we will log a warning message -const highWaitForSeconds = 60 +const highWaitForDuration = 60 * time.Second const ( boolVarFuncName = "LDClient.BoolVariation" @@ -333,9 +333,9 @@ func MakeCustomClient(sdkKey string, config Config, waitFor time.Duration) (*LDC // If you use a long duration and wait for the timeout, then any network delays will cause // your application to wait a long time before continuing execution. - if waitFor.Seconds() > highWaitForSeconds { - loggers.Warnf("Client was created was with a timeout greater than %d. "+ - "We recommend a timeout of less than %d seconds", highWaitForSeconds, highWaitForSeconds) + if waitFor > highWaitForDuration { + loggers.Warnf("Client was created was with a %v millisecond timeout. "+ + "We recommend a timeout of less than %v milliseconds", waitFor.Milliseconds(), highWaitForDuration.Milliseconds()) } timeout := time.After(waitFor) From af5cb0c0cae0caa4b97f096852119f7b3b5e77b2 Mon Sep 17 00:00:00 2001 From: Casey Waldren Date: Tue, 28 May 2024 14:30:50 -0700 Subject: [PATCH 2/2] wording --- ldclient.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ldclient.go b/ldclient.go index 436a9753..9dbd38ab 100644 --- a/ldclient.go +++ b/ldclient.go @@ -34,7 +34,8 @@ import ( // Version is the SDK version. const Version = internal.SDKVersion -// highWaitForSeconds is the initialization wait time threshold that we will log a warning message +// highWaitForDuration represents the maximum amount of time that the client should be +// told to wait when initializing above which we emit a log message warning the user of excessive wait time. const highWaitForDuration = 60 * time.Second const ( @@ -334,8 +335,8 @@ func MakeCustomClient(sdkKey string, config Config, waitFor time.Duration) (*LDC // If you use a long duration and wait for the timeout, then any network delays will cause // your application to wait a long time before continuing execution. if waitFor > highWaitForDuration { - loggers.Warnf("Client was created was with a %v millisecond timeout. "+ - "We recommend a timeout of less than %v milliseconds", waitFor.Milliseconds(), highWaitForDuration.Milliseconds()) + loggers.Warnf("Client was configured to block for up to %v milliseconds. "+ + "We recommend blocking no longer than %v milliseconds", waitFor.Milliseconds(), highWaitForDuration.Milliseconds()) } timeout := time.After(waitFor)