Skip to content

[FFL-2891] Add configurable Flags initialization deadline - #3114

Draft
sameerank wants to merge 1 commit into
developfrom
sameerank/FFL-2891/initialization-timeout
Draft

[FFL-2891] Add configurable Flags initialization deadline#3114
sameerank wants to merge 1 commit into
developfrom
sameerank/FFL-2891/initialization-timeout

Conversation

@sameerank

Copy link
Copy Markdown
Contributor

What and why?

Add a configurable overall deadline for initializing DatadogFlags assignments.

The default five-second deadline prevents client initialization from waiting indefinitely when persisted storage or the assignment request stalls. Users can customize it through Flags.Configuration.initializationTimeout.

How?

  • Start one deadline before reading cached assignments.
  • Apply it across cache loading, assignment fetching, response decoding, and state updates.
  • Cancel an in-flight assignment request when the deadline expires.
  • Ignore cache and network results arriving after the deadline.
  • Continue using matching cached assignments in the stale state; otherwise use coded defaults.
  • Validate custom timeout values and fall back to five seconds for non-positive or non-finite values.
  • Add coverage for cache delays, request cancellation, late responses, cached fallback, configuration, and API surface.

Review checklist

  • Feature or bugfix MUST have appropriate tests (unit, integration)
  • Make sure each commit and the PR mention the Issue number or JIRA reference
  • Add CHANGELOG entry for user facing changes
  • Add Objective-C interface for public APIs - N/A; DatadogFlags has no Objective-C configuration surface
  • Run make api-surface when adding new APIs

Validation completed:

  • All 117 DatadogFlags tests pass in Swift 5 compatibility mode.
  • Lint passes.
  • API surface generation passes.

The default Swift 6 test build is currently blocked by an unrelated existing DatadogTrace OpenTelemetry Sendable compilation issue.

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