Skip to content

fix(events): give each environment the whole byte capacity - #431

Open
abelonogov-ld wants to merge 1 commit into
andrey/event-durability-tier3-persistencefrom
andrey/event-capacity-bytes-per-environment
Open

abelonogov-ld wants to merge 1 commit into
andrey/event-durability-tier3-persistencefrom
andrey/event-capacity-bytes-per-environment

Conversation

@abelonogov-ld

@abelonogov-ld abelonogov-ld commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Each environment now has the whole capacityBytes, like capacity, rather than an equal share of it. This follows the review on iOS (ios-client-sdk#538), which makes the same change.

Stacked on #408 (tier 3).

  • An equal share is too small where there are many environments. Some customers configure 7, which at the default left each under 3 MiB.
  • Adding an environment no longer shrinks the others. A share was fixed when the store was built, so a directory within its old share could be over its new one, and new events were refused until delivery or expiry drained it.
  • The disk the SDK may use now grows with the environments: up to 20 MiB each at the default. Ordinary traffic reaches capacity (2000 events) long before that; only unusually large events, or summaries piling up through a long outage, get near it.
  • ComponentsImpl.shareOfCapacityBytes is gone; the store gets capacityBytes as it is, and already reads zero or less as the default. The EventProcessorBuilder.capacityBytes docs say it is for each environment.

Test: theByteCapacityIsSharedEquallyByTheConfiguredEnvironments becomes eachEnvironmentHasTheWholeByteCapacityHoweverManyAreConfigured: with seven environments and a 2,400-byte capacity, an 850-byte event is delivered, where the old split's 342 bytes would have refused it.

./gradlew :launchdarkly-android-client-sdk:testDebugUnitTest: 1257 tests, 0 failures (25 skipped).


Note

Overview
Persisted event byte limits are now per environment, matching capacity(int) and the iOS client change, instead of splitting capacityBytes evenly across all configured mobile keys.

ComponentsImpl drops shareOfCapacityBytes and passes the configured capacityBytes straight into EventStore.create. EventProcessorBuilder docs are updated to state each secondary environment gets the full limit, so adding environments no longer shrinks others and apps with many envs (e.g. seven) aren’t stuck with tiny per-env quotas.

The unit test is renamed and asserts that with seven environments and a 2,400-byte limit, an ~850-byte custom event still flushes—behavior that would fail under the old equal-share rule.

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

…hare of it

Co-authored-by: Cursor <cursoragent@cursor.com>
@abelonogov-ld
abelonogov-ld requested a review from a team as a code owner November 13, 2026 21:39

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated risk review (dry run): Medium

This PR would not be automatically approved. Human approval required.

Why: ComponentsImpl now gives every environment the full capacityBytes instead of a shared split, which changes persisted-event disk usage for multi-environment apps. The unit test covers the new per-environment quota, but that behavior change is above the Low auto-approval threshold. Human review is needed; no reviewers were assigned.

Open in Web View Automation 

Sent by Cursor Approval Agent: Dry-Run PR Approver

@cursor cursor Bot added the risk:medium label Nov 13, 2026

This branch has not been deployed

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant