Repository navigation
fix: Keep retrying the streaming connection after an unexpected HTTP error response - #352
jsonbailey wants to merge 1 commit into
Conversation
|
|
||
| switch (event) { | ||
| case MessageEvent(): | ||
| _retryState.recordSuccess(); |
There was a problem hiding this comment.
Any message, including ping, starts the 60 s healthy measurement. iOS (#533) and Android (#406) do the same. The spec clarification is sdk-specs #276.
| if (_stopped) { | ||
| return; | ||
| } | ||
| _generation++; |
There was a problem hiding this comment.
iOS and Android handle stream messages synchronously on the stream's own thread, so they cannot hit this. Here, DataSourceManager handles events asynchronously, so a late invalidMessage could restart a newer connection. The generation token ignores a restart for a connection that has been replaced.
| .asyncMap((event) async => (event, await handleEvent(event))) | ||
| .listen((handled) { | ||
| final (event, status) = handled; | ||
| if (status == MessageStatus.invalidMessage) { |
There was a problem hiding this comment.
Known follow-up: messages already queued from a restarted connection are still applied until the next full put. iOS does the same. Android drops them, because it restarts after the current message. Tracked separately.
Summary
Stacked on the identify docs PR. The FDv1 streaming data source no longer stops for good after an HTTP error such as a 401.
autoReconnect: false, closes it on any failure, and reconnects after theRetryStatedelay: 1 second up to 30 seconds normally, and 5 minutes up to 1 hour after an unexpected failure. The backoff resets after 60 seconds of healthy streaming.interrupted, as Android FDv2 does, and logs the failure kind.retry-conformance-fdv1-streaming.common_clientneeds the releasedlaunchdarkly_event_source_clientandlaunchdarkly_dart_commonversions before this merges. The pin bumps follow those releases.