Skip to content

fix: Keep analytics events with zero context cache capacity - #534

Open
fallintoplace wants to merge 1 commit into
launchdarkly:mainfrom
fallintoplace:fix/zero-context-key-capacity
Open

fallintoplace wants to merge 1 commit into
launchdarkly:mainfrom
fallintoplace:fix/zero-context-key-capacity

Conversation

@fallintoplace

@fallintoplace fallintoplace commented Oct 4, 2026 •

Copy link
Copy Markdown

What

  • Keep analytics events working when context_keys_capacity=0.

Why

  • The empty cache raises KeyError and drops identify, custom, and feature events.

Implementation

  • Skip cache writes when capacity is zero or negative.

Note

Overview
Fixes analytics delivery when context_keys_capacity=0 by treating zero or negative LRU capacity as a no-op cache.

SimpleLRUCache.put now returns False immediately when capacity <= 0, so nothing is stored and the event pipeline no longer hits errors from an effectively empty context-key cache (which previously dropped identify, custom, and feature events).

With capacity zero, context deduplication is disabled: each event is treated as a new context, so payloads include repeated index/identify entries (covered by new sync and async event-processor tests, plus LRU unit tests for capacities 0 and -1).

Reviewed by Cursor Bugbot for commit 6354988. Bugbot is set up for automated code reviews on this repo. Configure here.

@fallintoplace
fallintoplace requested a review from a team as a code owner October 4, 2026 13:58
@jsonbailey

Copy link
Copy Markdown
Contributor

@fallintoplace thank you for submitting this PR. I am going to review this with our team as this particular issue is impacts more than just the python server sdk and we need to decide how we want to address this for all SDKs. Can you share more about your use case for setting it to 0 or -1 so I can bring that up in the discussion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants