Skip to content

fix: handle deleted segments gracefully instead of looping on 404#612

Open
davemun wants to merge 1 commit intosplitio:developmentfrom
davemun:davemun/fix-split-proxy-and-deleted-segment-loop
Open

fix: handle deleted segments gracefully instead of looping on 404#612
davemun wants to merge 1 commit intosplitio:developmentfrom
davemun:davemun/fix-split-proxy-and-deleted-segment-loop

Conversation

@davemun
Copy link

@davemun davemun commented Feb 14, 2026

Ruby SDK

What did you accomplish?

When a segment is deleted in the Split UI, the SDK enters an infinite error loop because .segments.registered is append-only and the 404 response from segmentChanges raises an exception that gets retried every polling interval.

This PR handles 404 responses gracefully by returning nil from fetch_segment_changes, removing the segment from the registered set, and breaking the fetch loop.

How to test new changes?

bundle exec rspec spec/engine/api/segments_spec.rb

Extra Notes

We use split-proxy and we are seeing that every time we delete/rename a segment in Harness/Split, the various deployed Ruby Split clients will hammer split-proxy with requests for that deleted segment until that SDK is stopped and restarted.

This issue exists in your other implementations:

@davemun davemun requested a review from a team as a code owner February 14, 2026 00:37
@@ -19,6 +19,12 @@ def fetch_segments_by_names(names, fetch_options = { cache_control_headers: fals

loop do
segment = fetch_segment_changes(name, since, fetch_options)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

afaik if this throws, the other segments that were supposed to get updated in this polling cycle also do not receive an update, which is a secondary issue of this problem

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