Hello folks, When Twissandra <http://twissandra.com/> (Twitter clone example for Cassandra) post a tweet, it iterate all of the followers to insert a tweet_id to their time lines(see highlight):
def save_tweet(tweet_id, user_id, tweet): """ Saves the tweet record. """ # Generate a timestamp, and put it in the tweet record raw_ts = int(time.time() * 1e6) tweet['_ts'] = raw_ts ts = _long(raw_ts) encoded = dict(((k, json.dumps(v)) for k, v in tweet.iteritems())) # Insert the tweet, then into the user's timeline, then into the public one TWEET.insert(str(tweet_id), encoded) USERLINE.insert(str(user_id), {ts: str(tweet_id)}) USERLINE.insert(PUBLIC_USERLINE_KEY, {ts: str(tweet_id)}) # Get the user's followers, and insert the tweet into all of their streams follower_ids = [user_id] + get_follower_ids(user_id) * **for** **follower_id** **in** **follower_ids**:* * **TIMELINE**.**insert**(**str**(**follower_id**),** **{**ts**:** **str**(**tweet_id**)})* * * *My question is, If a user has millions of followers, is there millions of iterate?* * Sorry for my English :) Thanks! *