Skip to content

feat(events): default the event max age to 24 hours - #549

Merged
abelonogov-ld merged 2 commits into
andrey/event-durability-tier3-persistencefrom
andrey/event-max-age-24h
Nov 20, 2026
Merged

abelonogov-ld merged 2 commits into
andrey/event-durability-tier3-persistencefrom
andrey/event-max-age-24h

Conversation

@abelonogov-ld

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

Copy link
Copy Markdown
Contributor

Changes the default LDConfig.eventMaxAge from 7 days to 24 hours. Persisted events that have not been delivered within 24 hours are discarded and counted as dropped, and so is what the SDK stored for a mobile key the application stopped using. Applications can still set eventMaxAge to keep events longer. It has no effect where eventPersistence is .disabled.

Stacked on #538 (tier 3).

  • LDConfig.Defaults.eventMaxAge is now 24 * 60 * 60, and the docs on LDConfig.eventMaxAge and ObjcLDConfig.eventMaxAge say so.
  • LDConfigSpec asserts the new default.
  • Three EventStoreSpec tests that age a batch by 6 days or 1 day and expect it to be kept now age it by 12 hours. The tests that age by 8 or 30 days still exceed the maximum age and are unchanged.

Android counterpart: launchdarkly/android-client-sdk#424.

Tested: LaunchDarklyTests on Mac Catalyst, 1233 tests, 0 failures.


Note

Overview
Changes the default LDConfig.eventMaxAge from 7 days to 24 hours, so persisted analytics events (and stale on-disk data for unused mobile keys) are discarded sooner unless the app sets a higher value. This only applies when eventPersistence is enabled.

Updates LDConfig.Defaults.eventMaxAge, public and Objective-C (ObjcLDConfig) docstrings, LDConfigSpec default expectations, and EventStoreSpec expiry tests that previously aged batches by 6 days or 1 day now use 12 hours (0.5 days) so they still sit under the new ceiling.

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

Persisted events not yet delivered are discarded after 24 hours by default,
instead of 7 days. LDConfig.eventMaxAge still overrides it.

Co-authored-by: Cursor <cursoragent@cursor.com>
…rsistence' into andrey/event-max-age-24h

Co-authored-by: Cursor <cursoragent@cursor.com>

# Conflicts:
#	LaunchDarkly/LaunchDarkly/Models/LDConfig.swift
#	LaunchDarkly/LaunchDarkly/ObjectiveC/ObjcLDConfig.swift
@cursor cursor Bot added the risk:medium label Nov 19, 2026

@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.

Risk: Medium.

Automated risk review (dry run): Medium

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

Why: Changing LDConfig.Defaults.eventMaxAge from 7 days to 24 hours is a user-facing SDK default for persisted event retention (LDConfig.swift, ObjcLDConfig.swift), even though LDConfigSpec and EventStoreSpec were updated to match.

If you disagree with this review, share this PR in #feedback-agent-approvals or submit a changes-requested review explaining why.

Open in Web View Automation 

Sent by Cursor Approval Agent: Dry-Run PR Approver

abelonogov-ld added a commit to launchdarkly/android-client-sdk that referenced this pull request Nov 20, 2026
Changes `EventProcessorBuilder.DEFAULT_MAX_AGE_MILLIS` from 7 days to 24
hours. Persisted events that have not been delivered within 24 hours are
discarded and counted as dropped, and so is what the SDK stored for a
mobile key the application stopped using. Applications can still call
`maxAgeMillis(long)` to keep events longer. It has no effect where
`eventPersistence` is `DISABLED`.

Stacked on #408 (tier 3).

- `DEFAULT_MAX_AGE_MILLIS` is now `24L * 60 * 60 * 1000`, with its
Javadoc updated.
- `EventStoreBoundsTest.keepsABatchYoungerThanTheMaximumAge` aged its
batch by 6 days, which is now past the default; it ages it by 12 hours.
The tests that age by 8 days still exceed the maximum age and are
unchanged.

iOS counterpart: launchdarkly/ios-client-sdk#549.

Tested: `:launchdarkly-android-client-sdk:testDebugUnitTest`, 1257
tests, 0 failures.

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Overview**
> **Shortens the default retention window** for persisted analytics
events from **7 days to 24 hours** by updating
`EventProcessorBuilder.DEFAULT_MAX_AGE_MILLIS` and its Javadoc.
> 
> When event persistence is enabled, undelivered batches older than the
default max age are discarded (and counted as dropped); apps can still
override via `maxAgeMillis(long)`. The change has **no effect** when
`eventPersistence` is `DISABLED`.
> 
> `EventStoreBoundsTest.keepsABatchYoungerThanTheMaximumAge` now ages a
batch by **12 hours** instead of 6 days so it still falls under the new
default.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
057a2ef. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->

Co-authored-by: Cursor <cursoragent@cursor.com>
@abelonogov-ld
abelonogov-ld merged commit 61cb083 into andrey/event-durability-tier3-persistence Nov 20, 2026
7 checks passed
@abelonogov-ld
abelonogov-ld deleted the andrey/event-max-age-24h branch November 20, 2026 19:46
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.

2 participants