technoweenie / twitter-node

Discontinued: check out nTwitter
https://github.com/AvianFlu/ntwitter
MIT License
446 stars 547 forks source link

reconnect on failure ? #6

Open friggeri opened 14 years ago

friggeri commented 14 years ago

any plans to implement auto-reconnect on failure ?

technoweenie commented 14 years ago

I haven't had a need. I'm open for patches though.

friggeri commented 14 years ago

I'd gladly do so, but any idea how this could be tested ?

long story short : I started logging the activity on some keywords and my app crashed after 20 hours. Fiddled and try to add some reconnect after a couple of seconds… Crashed after 24 hours or so without reconnecting. Anyways, the thing is : I obviously can't afford to wait a day or so until a crash to see if my handling of a disconnect is working… Of course, I could switch on/off my laptop's wifi, but then again, just wondering if you had any ideas of a more… elegant way of dealing with it.

technoweenie commented 14 years ago

What's causing the crashes? If it's just a loss of connection between Twitter and your script, write a stupid simple node server that emits random json, and run local tests with it dying.

I've talked to some people that ran into this, and they just had some code that would immediately catch and reopen the connection. I switched jobs after writing this, and have no real use for it anymore. All I can suggest is try some stuff out in a personal fork, and submit a pull request to get some in the community to look at it. If it works, I'll gladly take the patch.

Also, try and be polite to Twitter's servers: http://dev.twitter.com/pages/user_streams_suggestions#Failure :)

cvee commented 13 years ago

I've submitted a patch for this issue. Please let me know if you have any questions.