-
Notifications
You must be signed in to change notification settings - Fork 160
Open
Labels
bugSomething isn't workingSomething isn't working
Description
I spent a good part of today debugging something that I think I would describe as a bit of footgun. To get straight to the point, consider the following code:
fn stream(
mut self
) -> LocalBoxStream<'static, Result<(String, Option<String>), EventSourceError>> {
self.event_source.subscribe("put").unwrap()
.map_ok(|(event_type, message)| (event_type, message.data().as_string()))
.boxed_local()
}In this code, self.event_source is a gloo_net::eventsource::futures::EventSource, however the returned stream just returns a ConnectionError when it is pulled. I didn't fully get to the bottom of this, however, it seems that self.event_source is dropped after this function returns, which is either disconnecting the event handlers or closing the connection.
I am sure that my sloppiness is partly to blame here, however, I am used to Rust preventing these sorts of footguns. Is there anything that can be done to improve this?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working