Skip to content

Commit

Permalink
fix: Always publish subscription message for realtime replay (#17338)
Browse files Browse the repository at this point in the history
  • Loading branch information
benjackwhite authored Sep 11, 2023
1 parent 0fe269b commit ce0b50e
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions posthog/session_recordings/realtime_snapshots.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ def get_realtime_snapshots(team_id: str, session_id: str, attempt_count=0) -> Op
key = get_key(team_id, session_id)
encoded_snapshots = redis.zrange(key, 0, -1, withscores=True)

# We always publish as it could be that a rebalance has occured and the consumer doesn't know it should be
# sending data to redis
redis.publish(SUBSCRIPTION_CHANNEL, json.dumps({"team_id": team_id, "session_id": session_id}))

if not encoded_snapshots and attempt_count < ATTEMPT_MAX:
logger.info(
"No realtime snapshots found, publishing subscription and retrying",
Expand Down

0 comments on commit ce0b50e

Please sign in to comment.