Skip to content

Feature store cache ignored prior to initialization #188

@farioas

Description

@farioas

Is this a support request?
no

Describe the bug
We're using Redis as a feature store cache. The logs are full of warning saying Feature Flag evaluation attempted before client has initialized.

To reproduce
Client initialization:

store = Redis.new_feature_store(
    url=settings.REDIS_LOCATION,
    prefix='feature-flags',
    caching=CacheConfig(expiration=30))
ldclient.set_config(Config(
    settings.FEATURE_FLAGS_API_KEY,
    feature_store=store,
    http=HTTPConfig(connect_timeout=5)
))
client = ldclient.get()

uwsgi short config:

enable-threads = True
lazy-apps = True

! Note: we're using lazy-apps mode, it will load an application one time per worker instead of preforking.

Expected behavior
There should be no warnings, because the feature store cache should be consulted prior initialization.

Logs

{"asctime": "29/Nov/2022:12:41:28 +0000", "name": "ldclient.util", "funcName": "_evaluate_internal", "lineno": 296, "levelname": "WARNING", "user_id": null, "message": "Feature Flag evaluation attempted before client has initialized - using last known values from feature store for feature key: ff_some_flag_redacted"}

SDK version

launchdarkly-server-sdk==7.5.0

Language version, developer tools
Python 3.8.10
uwsgi 2.0.21

OS/platform
Ubuntu 20.04

Additional context
The issue is very similar to launchdarkly/java-server-sdk#107

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions