Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Fix max collect id when API returns less results than expected #45

Merged
merged 2 commits into from May 23, 2012

Conversation

Projects
None yet
3 participants
Contributor

jphpsf commented May 23, 2012

The Twitter API returns inconsistent count of tweets and often the API response includes less tweets than the requested count.

This patch solves the issue by querying the Twitter API in a loop until the expected number of results is reached.

The code change is fairly simple: I just had to tweak the collect_with_number method to keep track of the number of tweets returned by the API. However, I had to fix many tests that got broken because of that change of behavior. One annoying side affect was that the fixtures included less than 20 tweets so a lot of the tests with the default count of 20 started failing. For that case, I added a few tweets to the fixture to get the count to 20.

Fix max collect id when API returns less results than expected
The Twitter API returns inconsistent count of tweets and often
the API response includes less tweets than the requested count.

This patch solves the issue by querying the Twitter API in a
loop until the expected number of results is reached.

This pull request fails (merged 929dd96 into 2bc8242).

Contributor

jphpsf commented May 23, 2012

Booooh me. That's lame. Not sure how I missed those failures. Let me fix that.

Owner

sferik commented May 23, 2012

Thanks @travisbot!

Contributor

jphpsf commented May 23, 2012

I am a little confused by these failures. It does not seem related to what I changed. I rebased from master to my branch so I had the latest code. Yet my code was failing but not master. The issue was a change in the parameters of does_follow. user_a and user_b are now screen_name_a and screen_name_b.

This pull request passes (merged cffb2b7 into 2bc8242).

sferik added a commit that referenced this pull request May 23, 2012

Merge pull request #45 from jphpsf/fix-max-id-collect
Fix max collect id when API returns less results than expected

@sferik sferik merged commit c6c9cd0 into sferik:master May 23, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment