Closed nono closed 11 years ago
Nice one. :)
Here's my code. It's broken and I won't have time to fix it.
As you want...
I think there's a misunderstanding here guys, we absolutely want any issues resolved and happily accept pull requests.
@nono, could you add tests for what's changed? Don't auto-reconnect after a stop should be an easy test case.
As for the reconnectors, I've tried to test reconnection thoroughly and there's quite a few tests in https://github.com/spagalloco/em-twitter/blob/master/spec/em-twitter/connection_reconnect_spec.rb to use as a starting point. Thanks.
I understand that this code should not be merged without tests. I've passed a few hours to debug it on a real case and I hope someone can make it a real tested patch. I won't have time for that (going to holidays soon), so I'm sorry but it's the best I can do for the moment.
I've implemented the auto-reconnect on stop fix in eb38a7e, so that just leaves the reconnector changes. These can be very difficult things to track down so I appreciate the work you did in identifying the issues. It might take me a few days to pull the rest of this in.
And I agree, this definitely seems related to intridea/tweetstream#84
Could anyone who's interested eyeball f1b41d7 for accuracy. The tests were difficult to write but I think I've caught all the caess. @nono @oz if you have been running off @nono's fork, could you try pointing at master to see if everything looks ok? Thanks guys.
Good job, but I think some corner cases are still not covered. I can explain the 3 issues I saw when debugging:
on_body
is called and creates a new ApplicationFailure object, so the retries count wasn't acurate. I think this one explains some behaviors of https://github.com/intridea/tweetstream/issues/84:TIMEOUT: 10 RETRIES: 0
TIMEOUT: 10 RETRIES: 0
TIMEOUT: 10 RETRIES: 0
Thanks for taking time for this unglamorous work :)
@nono, that's a good thought to test that the reconnector actually increments properly under expected scenarios. Thanks for the tips.
is the gem updated to reflect this change?
Also, noticing with the 0.1.4 version of the gem getting constant reconnect errors. With 0.1.3 everything seems fine.
@denen99 not yet. I have a few more test cases I want to cover before releasing a new version.
The only change in 0.1.4 is 9c760af640097a03e75492f5dae83a69608f0c7d which closes the connection on a stall, i haven't seen evidence of stalled?
working incorrectly, but will take a look. Are you tracking keywords where a stall is likely/possible?
its possible but as soon as I use 0.1.3, i get no reconnect errors. If i use 0.1.4, i hit the Reconnect Error with Timeout of 10 with 0 retries error quite quickly.
Is there a way to get more debug on when stalls happen ?
Is there a way to determine the HTTP response code ?
@denen99 The response code isn't currently accessible but you can retrieve it via instance_variable_get
on the Connection
. I can make it accesible, is there a reason you'd need it?
as for when stalls occur, use the Client#on_no_data_received
callback. The reason you don't see the reconnects in 0.1.3 is that stalls were not triggering reconnects.
Hi,
I've made some changes to em-twitter to make reconnection logic works as expected. I wrote no tests and I won't have time to make them, sorry.