fix: Log the cached-data evaluation warning only once per client - #2015
Draft
kinyoklion wants to merge 1 commit into
Draft
fix: Log the cached-data evaluation warning only once per client#2015kinyoklion wants to merge 1 commit into
kinyoklion wants to merge 1 commit into
Conversation
Contributor
|
@launchdarkly/js-sdk-common size report |
Contributor
|
@launchdarkly/js-client-sdk size report |
Contributor
|
@launchdarkly/js-client-sdk-common size report |
kinyoklion
force-pushed
the
rlamb/log-cached-data-warning-once
branch
from
September 11, 2026 22:23
95aca06 to
433c920
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When a variation or allFlagsState call arrives before the client has finished initializing and the feature store already holds data, the server client evaluates against that data and logs a warning. The warning is logged on every such call, so a client that is waiting on its data source while serving from a populated store (for example, a persistent store or an initializer snapshot) floods the log at the evaluation rate.
Both warnings are now logged once per client instance. A private boolean per message records that it was logged. The check and the write happen only inside the branch where the store reports initialized, so a normal evaluation does not touch them. JavaScript is single-threaded, so no synchronization is needed. Each message ends with a note that it is logged once.
The sibling messages for an uninitialized store, which return the default value or an empty state, are unchanged.
This package is shared by the Node server SDK and the edge SDKs, so all of them pick up the change.