From 403498a85bf9b5e4900d428ff85bd0184e409ea0 Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Thu, 18 Nov 2021 11:34:19 +0000 Subject: [PATCH] Only return non-stub rooms from `GetKnownRooms` (#2049) * Only return non-stub rooms from `GetKnownRooms` This should stop a bunch of errors at startup with invalid server ACLs. * Fix query --- roomserver/storage/postgres/rooms_table.go | 2 +- roomserver/storage/sqlite3/rooms_table.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/roomserver/storage/postgres/rooms_table.go b/roomserver/storage/postgres/rooms_table.go index ba8eb671..f51eba4d 100644 --- a/roomserver/storage/postgres/rooms_table.go +++ b/roomserver/storage/postgres/rooms_table.go @@ -74,7 +74,7 @@ const selectRoomInfoSQL = "" + "SELECT room_version, room_nid, state_snapshot_nid, latest_event_nids FROM roomserver_rooms WHERE room_id = $1" const selectRoomIDsSQL = "" + - "SELECT room_id FROM roomserver_rooms" + "SELECT room_id FROM roomserver_rooms WHERE array_length(latest_event_nids, 1) > 0" const bulkSelectRoomIDsSQL = "" + "SELECT room_id FROM roomserver_rooms WHERE room_nid = ANY($1)" diff --git a/roomserver/storage/sqlite3/rooms_table.go b/roomserver/storage/sqlite3/rooms_table.go index 2dfb830d..c441daec 100644 --- a/roomserver/storage/sqlite3/rooms_table.go +++ b/roomserver/storage/sqlite3/rooms_table.go @@ -65,7 +65,7 @@ const selectRoomInfoSQL = "" + "SELECT room_version, room_nid, state_snapshot_nid, latest_event_nids FROM roomserver_rooms WHERE room_id = $1" const selectRoomIDsSQL = "" + - "SELECT room_id FROM roomserver_rooms" + "SELECT room_id FROM roomserver_rooms WHERE latest_event_nids != '[]'" const bulkSelectRoomIDsSQL = "" + "SELECT room_id FROM roomserver_rooms WHERE room_nid IN ($1)"