fix: handle deleted segments gracefully instead of looping on 404#612
Open
davemun wants to merge 1 commit intosplitio:developmentfrom
Open
fix: handle deleted segments gracefully instead of looping on 404#612davemun wants to merge 1 commit intosplitio:developmentfrom
davemun wants to merge 1 commit intosplitio:developmentfrom
Conversation
davemun
commented
Feb 14, 2026
| @@ -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) | |||
Author
There was a problem hiding this comment.
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
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.
Ruby SDK
What did you accomplish?
When a segment is deleted in the Split UI, the SDK enters an infinite error loop because
.segments.registeredis 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
nilfromfetch_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.rbExtra 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: