Skip to content

fix: stop accumulating WhenAny continuations on the Conditions aggregate#562

Draft
beekld wants to merge 4 commits into
mainfrom
beeklimt/SDK-2551
Draft

fix: stop accumulating WhenAny continuations on the Conditions aggregate#562
beekld wants to merge 4 commits into
mainfrom
beeklimt/SDK-2551

Conversation

@beekld

@beekld beekld commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

The FDv2 data system's Conditions::GetFuture() previously returned the same shared future to every iteration of RunSynchronizerNext, so each iteration's WhenAny(cond_future, next_future).Then(...) appended a callback to the shared future's continuations_ vector. On a healthy primary streaming changesets without ever firing fallback/recovery, those continuations accumulated for the synchronizer's lifetime.

  • Conditions::GetFuture(token) now returns a fresh Future per call.
    • The caller cancels its CancellationSource after the WhenAny resolves.
    • The cancellation callback erases the per-call Promise from a pending list inside Conditions.
  • A single permanent listener on the underlying aggregate drains the pending list and resolves each Promise when any condition fires.

Analogous to launchdarkly/java-core#163.

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.

1 participant