Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: align high timeout log msg with spec #150

Merged
merged 2 commits into from
Jun 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions ldclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,9 @@ import (
// Version is the SDK version.
const Version = internal.SDKVersion

// highWaitForSeconds is the initialization wait time threshold that we will log a warning message
const highWaitForSeconds = 60
// 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 (
boolVarFuncName = "LDClient.BoolVariation"
Expand Down Expand Up @@ -333,9 +334,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 configured to block for up to %v milliseconds. "+
"We recommend blocking no longer than %v milliseconds", waitFor.Milliseconds(), highWaitForDuration.Milliseconds())
}

timeout := time.After(waitFor)
Expand Down
Loading