Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
ce37aba
Replace SonarSource/sonarcloud-github-action
melinaurruchua Dec 2, 2025
09e8b45
Merge pull request #605 from splitio/CLI-52751-sonar
Dec 2, 2025
c65fd01
added models, events config data and events metadata
chillaq Jan 7, 2026
661d248
updated metadata to recent spec
chillaq Jan 8, 2026
5d814b5
added events manager and events delivery
chillaq Jan 9, 2026
a37d3b9
added internal sdk task
chillaq Jan 12, 2026
e019bb3
polish
chillaq Jan 13, 2026
a5aa01d
Merge pull request #608 from splitio/FME-12219-sdk-events-models
chillaq Jan 13, 2026
59a5530
polish
chillaq Jan 13, 2026
b92badd
Merge pull request #610 from splitio/FME-12220-sdk-events-manager
chillaq Jan 13, 2026
7c91986
polish
chillaq Jan 13, 2026
27792de
Merge pull request #611 from splitio/FME-12221-sdk-event-task
chillaq Jan 13, 2026
6e3ea36
Updated split storage
chillaq Jan 13, 2026
0989330
Merge pull request #612 from splitio/FME-12222-sdk-events-split-storage
chillaq Jan 13, 2026
b00410d
updated segments and rb segments storages
chillaq Jan 14, 2026
00227ce
Merge pull request #613 from splitio/FME-12223-sdk-events-segments
chillaq Jan 14, 2026
8171606
update factory class for ready and timedout events
chillaq Jan 14, 2026
6d344a6
updated client and factory classes
chillaq Jan 16, 2026
c14e651
Merge pull request #614 from splitio/FME-12227-sdk-events-factory
chillaq Jan 16, 2026
02027af
Merge pull request #615 from splitio/FME-12224-sdk-event-client
chillaq Jan 16, 2026
f0d85ba
updated sdk ready firing after subscription and integration tests
chillaq Jan 16, 2026
983a740
avoid fire events if no items added or removed from storage
chillaq Jan 20, 2026
0df687f
Merge pull request #616 from splitio/FME-12225-sdk-events-integration
chillaq Jan 20, 2026
7194c0a
added async classes
chillaq Jan 21, 2026
f2ad152
finish tests
chillaq Jan 21, 2026
4327a30
updated localhost classes and tests
chillaq Jan 22, 2026
e7f721a
fixed typo for segment event type
chillaq Jan 22, 2026
b92aa3c
Merge branch 'feature/sdk-events' into FME-12276-async-classes
chillaq Jan 22, 2026
11d56fd
fixed typo for segment update type
chillaq Jan 22, 2026
f2608fa
Merge branch 'FME-12276-async-classes' into FME-12226-events-localhost
chillaq Jan 22, 2026
e06630f
Merge pull request #617 from splitio/FME-12276-async-classes
chillaq Jan 22, 2026
06950f0
Merge pull request #618 from splitio/FME-12226-events-localhost
chillaq Jan 22, 2026
8f29ba9
ignored fetching rbs if list is empty
chillaq Jan 22, 2026
3849e9b
Merge pull request #619 from splitio/FME-12322-fix-redis-prefix
chillaq Jan 22, 2026
09dd7e5
removed name param from creat_task, supported only after 3.8
chillaq Jan 22, 2026
15ca507
updated changes
chillaq Jan 27, 2026
27e2592
fixed test
chillaq Jan 27, 2026
2244773
polishing
chillaq Jan 27, 2026
3a9d2a7
fixed calling fire event function
chillaq Jan 27, 2026
43dfb55
updated license and added notice
chillaq Jan 27, 2026
07e8aec
Merge pull request #620 from splitio/feature/sdk-events
chillaq Jan 27, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
updated localhost classes and tests
  • Loading branch information
chillaq committed Jan 22, 2026
commit 4327a301e2fc46cddf9b7440394405c801b3e10e
22 changes: 14 additions & 8 deletions splitio/client/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -1145,11 +1145,11 @@ def _build_localhost_factory(cfg):
telemetry_runtime_producer = telemetry_producer.get_telemetry_runtime_producer()
telemetry_evaluation_producer = telemetry_producer.get_telemetry_evaluation_producer()

events_queue = queue.Queue()
internal_events_queue = queue.Queue()
storages = {
'splits': InMemorySplitStorage(events_queue, cfg['flagSetsFilter'] if cfg['flagSetsFilter'] is not None else []),
'segments': InMemorySegmentStorage(events_queue), # not used, just to avoid possible future errors.
'rule_based_segments': InMemoryRuleBasedSegmentStorage(events_queue),
'splits': InMemorySplitStorage(internal_events_queue, cfg['flagSetsFilter'] if cfg['flagSetsFilter'] is not None else []),
'segments': InMemorySegmentStorage(internal_events_queue), # not used, just to avoid possible future errors.
'rule_based_segments': InMemoryRuleBasedSegmentStorage(internal_events_queue),
'impressions': LocalhostImpressionsStorage(),
'events': LocalhostEventsStorage(),
}
Expand All @@ -1162,6 +1162,8 @@ def _build_localhost_factory(cfg):
LocalSegmentSynchronizer(cfg['segmentDirectory'], storages['splits'], storages['segments']),
None, None, None,
)
events_manager = EventsManager(EventsManagerConfig(), EventsDelivery())
internal_events_task = EventsTask(events_manager.notify_internal_event, internal_events_queue)

feature_flag_sync_task = None
segment_sync_task = None
Expand All @@ -1178,6 +1180,7 @@ def _build_localhost_factory(cfg):
feature_flag_sync_task,
segment_sync_task,
None, None, None,
internal_events_task=internal_events_task
)

sdk_metadata = util.get_metadata(cfg)
Expand All @@ -1199,8 +1202,7 @@ def _build_localhost_factory(cfg):
telemetry_evaluation_producer,
telemetry_runtime_producer
)
internal_events_queue = queue.Queue()
events_manager = EventsManager(EventsManagerConfig(), EventsDelivery())
internal_events_task.start()

return SplitFactory(
'localhost',
Expand All @@ -1226,6 +1228,8 @@ async def _build_localhost_factory_async(cfg):

internal_events_queue = asyncio.Queue()
events_manager = EventsManagerAsync(EventsManagerConfig(), EventsDelivery())
internal_events_task = EventsTaskAsync(events_manager.notify_internal_event, internal_events_queue)

storages = {
'splits': InMemorySplitStorageAsync(internal_events_queue),
'segments': InMemorySegmentStorageAsync(internal_events_queue), # not used, just to avoid possible future errors.
Expand Down Expand Up @@ -1258,6 +1262,7 @@ async def _build_localhost_factory_async(cfg):
feature_flag_sync_task,
segment_sync_task,
None, None, None,
internal_events_task=internal_events_task
)

sdk_metadata = util.get_metadata(cfg)
Expand All @@ -1277,8 +1282,9 @@ async def _build_localhost_factory_async(cfg):
storages['impressions'],
telemetry_evaluation_producer,
telemetry_runtime_producer
)

)
internal_events_task.start()

return SplitFactoryAsync(
'localhost',
storages,
Expand Down
12 changes: 8 additions & 4 deletions splitio/sync/synchronizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -955,12 +955,13 @@ def sync_all(self, till=None):

def stop_periodic_fetching(self):
"""Stop fetchers for feature flags and segments."""
_LOGGER.debug('Stopping periodic fetching')
if self._split_tasks.split_task is not None:
_LOGGER.debug('Stopping periodic fetching')
self._split_tasks.split_task.stop()
if self._split_tasks.segment_task is not None:
self._split_tasks.segment_task.stop()
if self._split_tasks.internal_events_task:
_LOGGER.debug('Stopping internal events notification')
self._split_tasks.internal_events_task.stop()

def synchronize_splits(self):
Expand Down Expand Up @@ -1031,12 +1032,15 @@ async def sync_all(self, till=None):

async def stop_periodic_fetching(self):
"""Stop fetchers for feature flags and segments."""
_LOGGER.debug('Stopping periodic fetching')
if self._split_tasks.split_task is not None:
_LOGGER.debug('Stopping periodic fetching')
await self._split_tasks.split_task.stop()
if self._split_tasks.segment_task is not None:
await self._split_tasks.segment_task.stop()

await self._split_tasks.segment_task.stop()
if self._split_tasks.internal_events_task is not None:
_LOGGER.debug('Stopping internal events notification')
await self._split_tasks.internal_events_task.stop()

async def synchronize_splits(self):
"""Synchronize all feature flags."""
try:
Expand Down
15 changes: 15 additions & 0 deletions tests/integration/test_streaming_e2e.py
Original file line number Diff line number Diff line change
Expand Up @@ -1367,6 +1367,9 @@ def test_change_number(mocker):
class StreamingIntegrationAsyncTests(object):
"""Test streaming operation and failover."""

update_flag = False
metadata = []

@pytest.mark.asyncio
async def test_happiness(self):
"""Test initialization & splits/segment updates."""
Expand Down Expand Up @@ -1421,6 +1424,7 @@ async def test_happiness(self):

factory = await get_factory_async('some_apikey', **kwargs)
await factory.block_until_ready(1)
await factory.client().on(SdkEvent.SDK_UPDATE, self._update_callcack)
assert factory.ready
assert await factory.client().get_treatment('maldo', 'split1') == 'on'

Expand All @@ -1437,6 +1441,13 @@ async def test_happiness(self):
'rbs': {'t': -1, 's': -1, 'd': []}}
sse_server.publish(make_split_change_event(2))
await asyncio.sleep(1)
flag = False
for meta in self.metadata:
if 'split1' in meta.get_names():
assert meta.get_type() == SdkEventType.FLAG_UPDATE
flag = True
assert flag

assert await factory.client().get_treatment('maldo', 'split1') == 'off'

split_changes[2] = {'ff': {
Expand Down Expand Up @@ -1556,6 +1567,10 @@ async def test_happiness(self):
sse_server.stop()
split_backend.stop()

async def _update_callcack(self, metadata):
self.update_flag = True
self.metadata.append(metadata)

@pytest.mark.asyncio
async def test_occupancy_flicker(self):
"""Test that changes in occupancy switch between polling & streaming properly."""
Expand Down
1 change: 0 additions & 1 deletion tests/sync/test_synchronizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,6 @@ def intersect(sets):
mocker.Mock(), mocker.Mock())

synchronizer = Synchronizer(split_synchronizers, mocker.Mock(spec=SplitTasks))
# pytest.set_trace()
self.clear = False
def clear():
self.clear = True
Expand Down