Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FFM-8067 Call onStreamError anytime we exit Subscribe #115

Merged
merged 1 commit into from
Jun 2, 2023
Merged

Conversation

jcox250
Copy link
Contributor

@jcox250 jcox250 commented May 31, 2023

What

  • Makes sure we call onStreamError anytime we break out of the SubscribeWithContext function
  • If an eventListener has been passed to the Proxy we call its Pub method with an error. This lets the eventListener know that the stream its listening to has disconnected

Why

  • Currently we only call onStreamError if SubscribeWithContext returns an error. However if the stream is intentionally closed by the server rather than bubbling up the EOF error the SSE library we're using swallows it. This means we never call onStreamError which means the SDK thinks it's still connected to the stream and receiving SSE events which means it stops getting any changes because it isn't operating in polling mode and won't get any SSE events. Calling onStreamError means we'll set streamConnected=false and the SDK will poll for changes until it can reconnect to the stream
  • For the eventListner code we can use this in the ff-proxy to pass on disconnects between the Proxy & ff-server to SDKs connected to the Proxy

Testing

I've been testing this out locally by getting the Proxy to close the stream with the SDK if it disconnects from ff-server

**What**

- Makes sure we call `onStreamError` anytime we break out of the
  SubscribeWithContext function
- If an eventListener has been passed to the Proxy we call its `Pub`
  method with an error. This lets the eventListener know that the stream
its listening to has disconnected

**Why**

- Currently we only call `onStreamError` if SubscribeWithContext returns
  an error. However if the stream is intentionally closed by the server
rather than bubbling up the EOF error the SSE library we're using
swallows it. This means we never call `onStreamError` which means the
SDK thinks it's still connected to the stream and receiving SSE events
which means it stops getting any changes because it isn't operating in
polling mode and won't get any SSE events. Calling `onStreamError` means we'll set `streamConnected=false` and the
SDK will poll for changes until it can reconnect to the stream
- For the eventListner code we can use this in the ff-proxy to pass on
  disconnects between the Proxy & ff-server to SDKs connected to the
Proxy

**Testing**

I've been testing this out locally by getting the Proxy to close the
stream with the SDK if it disconnects from ff-server
@swarmia
Copy link

swarmia bot commented May 31, 2023

@jcox250 jcox250 merged commit fcab188 into main Jun 2, 2023
3 checks passed
@erdirowlands erdirowlands deleted the FFM-8067 branch November 3, 2023 17:45
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.

None yet

2 participants