Skip to content

Instantly share code, notes, and snippets.

@haileys
Last active December 31, 2015 17:29
Show Gist options
  • Save haileys/8020232 to your computer and use it in GitHub Desktop.
Save haileys/8020232 to your computer and use it in GitHub Desktop.
def get_ids(ids)
$client.users(ids)
rescue Twitter::Error::NotFound => e
if ids.size == 1
[]
else
a, b = ids[0...ids.length / 2], ids[ids.length / 2..-1]
get_ids(a) + get_ids(b)
end
end
@caarlos0
Copy link

LOL

@benlovell
Copy link

:shipit:

@sferik
Copy link

sferik commented Dec 18, 2013

You should make the get_ids(a) and get_ids(b) requests in separate threads. That will make this code about twice as fast.

@arthurnn
Copy link

you probably will explode API limits pretty quickly too ..

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