Concatenation Is Not Merging
A hybrid feed pushes ordinary posts into a materialized timeline and pulls posts from accounts above the celebrity threshold at read time. Users report that celebrity posts almost never appear in their feed, even minutes after publication, and the fan-out and pull services both look healthy.
def home_timeline(user_id, limit=50):
pushed = timeline_cache.range(user_id, 0, limit) # newest first, up to `limit`
pulled = []
for author in celebrity_follows(user_id):
pulled.extend(posts_by_author(author, limit)) # newest first, per author
merged, seen, out = pushed + pulled, set(), []
for p in merged:
if p.id in seen:
continue
seen.add(p.id)
out.append(p)
return out[:limit]
What is wrong?
Sign in to answer questions and track your progress
Sign In