Created
January 19, 2016 19:31
-
-
Save kennym/24869fed4d29f8aee5e0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| User.dataset.each_page(50) do |dataset| | |
| follows = [] | |
| followers = [] | |
| dataset.each do |user| | |
| puts "Processing user ##{user.id}" | |
| user.favorites.each do |favorite_user| | |
| follows << { source: "flat:#{user.id}", target: "user:#{favorite_user.id}" } | |
| end | |
| user.followers.each do |follower| | |
| followers << { source: "user:#{follower.id}", target: "flat:#{user.id}" } | |
| end | |
| end | |
| STREAM_CLIENT.follow_many(follows) | |
| STREAM_CLIENT.follow_many(followers) | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment