tests require deterministic ordering of priority rooms

This commit is contained in:
Neil Johnson
2026-03-26 13:37:55 +00:00
parent 596ffb81c2
commit a27757bfb2

View File

@@ -757,10 +757,11 @@ class ProfileHandler:
)
# Sort rooms by activity (descending stream ordering)
# Use room_id as tiebreaker for deterministic ordering
# Higher activity first, then alphabetically by room_id for ties
priority_room_ids = sorted(
room_activity.keys(),
key=lambda rid: room_activity.get(rid, 0),
reverse=True,
key=lambda rid: (-room_activity.get(rid, 0), rid),
)[:NUMBER_OF_PRIORITISED_ROOMS]
# Store the priority list so we can resume if interrupted