Skip to content

Instantly share code, notes, and snippets.

@vardanator
Created February 18, 2018 19:29
Show Gist options
  • Select an option

  • Save vardanator/8d0fc0ee80d1b220b2b1d4f9a77768e8 to your computer and use it in GitHub Desktop.

Select an option

Save vardanator/8d0fc0ee80d1b220b2b1d4f9a77768e8 to your computer and use it in GitHub Desktop.
// 'author' represents the User object, at this point we are interested only in author.id
//
// 'tw' is a Tweet object, at this point we are interested only in 'tw.id'
void DeliverATweet(User* author, Tweet* tw)
{
// we assume that 'tw' object is already stored in a database
// 1. Get the list of user's followers (author of the tweet)
vector<User*> user_followers = GetUserFollowers(author->id);
for (auto follower : user_followers) {
InsertTweetIntoUserTimeline(follower->id, tw->id);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment