Feat/streaming - #201
Merged
Merged
Conversation
FredrikOseberg
force-pushed
the
feat/streaming
branch
from
August 29, 2025 08:02
db928fb to
a3bb209
Compare
FredrikOseberg
commented
Aug 29, 2025
| assert.False(t, client.IsEnabled("feature-1"), "feature-1 should be initially disabled") | ||
|
|
||
| // Wait for the update event to be processed | ||
| time.Sleep(200 * time.Millisecond) |
Contributor
Author
There was a problem hiding this comment.
listen to update event
kwasniew
reviewed
Aug 29, 2025
kwasniew
reviewed
Aug 29, 2025
| return nil | ||
| } | ||
|
|
||
| log.Print("Setting up client") |
kwasniew
reviewed
Aug 29, 2025
kwasniew
reviewed
Aug 29, 2025
kwasniew
reviewed
Aug 29, 2025
| backupPath string | ||
| refreshInterval time.Duration | ||
| storage Storage | ||
| httpClient *http.Client |
kwasniew
reviewed
Aug 29, 2025
| if repo.isStreaming { | ||
| repo.streamingClient = newStreamingClient( | ||
| options, | ||
| repo, |
Contributor
There was a problem hiding this comment.
this is weird that repository created a streaming client and passes itself as argument
kwasniew
reviewed
Aug 29, 2025
| // deltaProcessor handles processing of delta events and updating the feature storage | ||
| type deltaProcessor struct { | ||
| storage Storage | ||
| repository *repository // Repository reference for segment manipulation |
Contributor
There was a problem hiding this comment.
can it depend on some inverted dependency being the operation that will be called. because now we have a cyclical dependency where repository creates delta processor and processor calls repository creating a cycle.
kwasniew
reviewed
Sep 1, 2025
| r.segments = segments | ||
|
|
||
| // Update storage | ||
| return r.options.storage.Reset(features, true) |
Contributor
There was a problem hiding this comment.
some claude analysis told me it may lead to race conditions with isEnabled calls but haven't dug deeper
kwasniew
approved these changes
Sep 1, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR introduces experimental streaming mode support to the
Unleash Go SDK, enabling real-time feature flag updates through
Server-Sent Events (SSE) instead of traditional polling. The
implementation provides instant updates when feature flags change
on the server.
Key Features
for instant feature flag changes
streaming is unavailable
using hydration and delta events
to work without changes
recovery
Architecture Changes
New Components
and event processing
events and manages feature state
updates including:
Key Implementation Details
connections
state
separation
processing, eliminating redundant full-response logic
Configuration
Enable streaming mode by setting the experimental streaming
configuration:
unleash.Initialize(
unleash.WithUrl("https://your-unleash-instance.com/api/"),
unleash.WithAppName("my-app"),
unleash.WithExperimental(map[string]interface{}{
"type": "streaming",
}),
)
Testing
work
Files Changed
support