Skip to content

Reconnect on hangup or timeut#201

Open
stephenwithav wants to merge 3 commits into
orakaro:masterfrom
stephenwithav:reconnect-on-hangup-or-timeut
Open

Reconnect on hangup or timeut#201
stephenwithav wants to merge 3 commits into
orakaro:masterfrom
stephenwithav:reconnect-on-hangup-or-timeut

Conversation

@stephenwithav

Copy link
Copy Markdown

@dtvd if you're okay with the PR suggested in #199 (comment) ... here you go. 😃

rainbowstreamをありがとうございました.

    -rename stream to stream_aux
    -stream_aux returns whether or not to reconnect
    -add new stream function to handle reconnects
@ghost

ghost commented Oct 24, 2016

Copy link
Copy Markdown

@stephenwithav Do your changes help with the Hangup errors?

@stephenwithav

Copy link
Copy Markdown
Author

@ManasB the changes will automatically reconnect after receiving a Hangup message if AUTO_RECONNECT is true.

@orakaro

orakaro commented Oct 25, 2016

Copy link
Copy Markdown
Owner

Hi @stephenwithav, thanks for contribution.
Does this prevent hangup happens after reconnect ?

@ghost

ghost commented Oct 25, 2016

Copy link
Copy Markdown

@dtvd

I think it will attempt to reconnect upon a Hangup or Timeout (if the setting is enabled)
@stephenwithav should clarify this though

With regards to preventing a Hangup/Timeout, if it isn't an error/disconnect on the client's side then there's not much to prevent? I'm familiarizing myself with rainbowstream's code. Thank you for developing this program!

I think having a 'Reconnect on Hangup/Timeout' is useful, though you may run into Twitter's connection rate limit. Now that I think of it, I guess that my errors were related to hitting Twitter's rate limit.

@orakaro

orakaro commented Oct 25, 2016

Copy link
Copy Markdown
Owner

Yes reaching rate limit was my concern. Automatically reconnecting can lead to rate limit easily and in theory you will be blocked for a while before you can try again. So best practice maybe limit (for example, 3 times) of reconnecting.

@stephenwithav

Copy link
Copy Markdown
Author

Can you provide a link to Twitter's rate limit documentation?

This code simply reconnects when a Hangup message is received--or there's a heartbeat timeout.

@orakaro

orakaro commented Oct 25, 2016

Copy link
Copy Markdown
Owner

https://dev.twitter.com/streaming/overview/connecting

Yes this wraps calling TwitterStream inside a while loop without limit. I guess we will need some backoff strategies.

@stephenwithav

Copy link
Copy Markdown
Author

Thank you, @dtvd. The docs suggest delaying reconnect attempts in increments of 250ms up to 16s, which shouldn't be difficult.

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.

2 participants