Skip to content

Conversation

@instantiator
Copy link
Contributor

@instantiator instantiator commented Dec 6, 2022

I gave some thought to streaming robustness, and here's an unsolicited/proposal for a change that might help to improve the robustness of streaming. You can provide optional timeout and restart parameters.

If timeout is provided, the TimelineHttpStreaming and TimelineWebSocketStreaming will count time since the last successful message (or comment) is received through the stream, and time out if it has been longer than the timeout provided.

If restart is true (default = true), then on a timeout, it will attempt to reconnect and restart the stream. If not, it'll throw the TimeoutException up the stack.

I've not given it a test yet - it's more of a proposal to talk through. What do you think?

Fixes: #89

@instantiator instantiator changed the title Streaming robustness Streaming robustness proposal Dec 6, 2022
@instantiator instantiator marked this pull request as draft December 6, 2022 16:20
@instantiator
Copy link
Contributor Author

Change of heart, I don't think this proposed change should be throwing an exception when it's a (potentially) unawaited Task. I think it should probably just fire an event when it finishes.

@glacasa
Copy link
Owner

glacasa commented Dec 7, 2022

Thanks for your feedback, I think you are the first dev to actually use streaming with this lib

It's a big subject, and there are improvements to be done, like issue #76
I need to take some time to look at that
(Note : streaming doc is there https://docs.joinmastodon.org/methods/streaming/ )

@instantiator
Copy link
Contributor Author

Thanks. Happy to help if I can. In the meantime I'm polling from my project 👍

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.

Streaming robustness

2 participants