Keep same-second unread events and bound idle push connections

This commit is contained in:
GPT on behalf of DHH
2026-10-07 11:00:47 +02:00
parent 14a2f8f550
commit 27065ef489
7 changed files with 41 additions and 7 deletions
+1 -1
View File
@@ -13,7 +13,7 @@ module Message::Broadcasts
# only the ones who still have it unread or are in it now: by the time this runs,
# someone may have opened the room and moved on, and would see it marked unread again.
def broadcast_unread_room
payload = ActiveSupport::JSON.encode(roomId: room.id, at: created_at.to_fs(:epoch))
payload = ActiveSupport::JSON.encode(roomId: room.id, at: created_at.to_f)
room.memberships.unread.or(room.memberships.connected).pluck(:user_id).each do |user_id|
ActionCable.server.broadcast UnreadRoomsChannel.stream_name_for(user_id), payload, coder: nil