Skip to content

Conversation

@kwasniew
Copy link
Contributor

@kwasniew kwasniew commented Dec 19, 2024

About the changes

Improving retry on streaming behavior.
Previously we were only retrying on 500 codes.

Details:

  • handling unleash-connected event but we ignore it on first connect. First connect is done with a regular fetch for a safety fallback e.g. when server doesn't support streaming
  • telling eventsource client to retry all types of errors so when some network proxy ends the connection without sending HTTP code we still re-connect and refetch the features from the unleash-connected event data (no data updated during proxy downtime is lost as a result)

Important files

Discussion points

@coveralls
Copy link

coveralls commented Dec 19, 2024

Coverage Status

coverage: 90.377% (-0.01%) from 90.39%
when pulling 33c250d on retry-all-streaming-errors
into 098551c on main.


const before = repo.getToggles();
t.deepEqual(before, []);
t.deepEqual(before, [{ ...feature, name: 'initialFetch' }]);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

test showing initial fetch is outside of the streaming flow

// first connection is ignored, since we do regular fetch
eventSource.emit('unleash-connected', {
type: 'unleash-connected',
data: JSON.stringify({ meta: {}, features: [{ ...feature, name: 'intialConnectedIgnored' }] }),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

show that initial streaming connect is ignored

thomasheartman
thomasheartman previously approved these changes Dec 19, 2024
@kwasniew kwasniew merged commit 60807bf into main Dec 19, 2024
4 checks passed
@kwasniew kwasniew deleted the retry-all-streaming-errors branch December 19, 2024 10:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants