diff --git a/launchdarkly-server-sdk/Cargo.toml b/launchdarkly-server-sdk/Cargo.toml index 809194a..fb8b07e 100644 --- a/launchdarkly-server-sdk/Cargo.toml +++ b/launchdarkly-server-sdk/Cargo.toml @@ -17,7 +17,7 @@ exclude = [ chrono = "0.4.19" crossbeam-channel = "0.5.1" data-encoding = "2.3.2" -eventsource-client = { version = "0.12.2", default-features = false } +eventsource-client = { version = "0.13.0", default-features = false } futures = "0.3.12" lazy_static = "1.4.0" log = "0.4.14" diff --git a/launchdarkly-server-sdk/src/data_source.rs b/launchdarkly-server-sdk/src/data_source.rs index ce19a34..9129533 100644 --- a/launchdarkly-server-sdk/src/data_source.rs +++ b/launchdarkly-server-sdk/src/data_source.rs @@ -131,18 +131,22 @@ impl DataSource for StreamingDataSource { event = event_stream.next() => { let event = match event { Some(Ok(event)) => match event { + es::SSE::Connected(_) => { + debug!("data source connected"); + continue; + }, es::SSE::Comment(str)=> { debug!("data source got a comment: {}", str); continue; }, es::SSE::Event(ev) => ev, }, - Some(Err(es::Error::UnexpectedResponse(status_code))) => { - match is_http_error_recoverable(status_code.as_u16()) { + Some(Err(es::Error::UnexpectedResponse(response, _))) => { + match is_http_error_recoverable(response.status()) { true => continue, _ => { notify_init.call_once(|| (init_complete)(false)); - warn!("Returned unrecoverable failure. Unexpected response {:?}", status_code); + warn!("Returned unrecoverable failure. Unexpected response {}", response.status()); break } }