Created
April 15, 2011 16:53
-
-
Save phobeo/922023 to your computer and use it in GitHub Desktop.
queues sample
This file contains 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
class ProcessTimeline | |
def perform(tweet, user) | |
log "received #{tweet.id} for user #{user}" | |
# if tweet.id was not stored before, store tweet in all_tweets_for process collection | |
# store pair [tweet.id, user.id] in tweets_for_user collection | |
end | |
end | |
class ProcessTweet | |
def perform(tweet) | |
log "processing tweet #{tweet.id} | |
# do tweet analysis | |
end | |
end | |
# Log should look like: | |
received xxxxx for user ernestojimenez | |
received xxxxx for user phobeo | |
processing tweet xxxxx | |
# or it may look like | |
received xxxxx for user ernestojimenez | |
processing tweet xxxxx | |
received xxxxx for user phobeo | |
# or also | |
received xxxxx for user phobeo | |
processing tweet xxxxx | |
received xxxxx for user ernestojimenez | |
# but it should always process just one time, no? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment