summary refs log tree commit diff
diff options
context:
space:
mode:
authorNeil Johnson <neil@fragile.org.uk>2018-01-25 23:28:44 +0000
committerNeil Johnson <neil@fragile.org.uk>2018-01-25 23:28:44 +0000
commit349c7399663b5fce856995a3a901019f5d210cc4 (patch)
tree3fd51e198dfefb3fcd98e1a93e8620701f8e7d16
parentMerge pull request #2821 from matrix-org/rav/matthew_test_fixes (diff)
downloadsynapse-349c7399663b5fce856995a3a901019f5d210cc4.tar.xz
synapse 500s on a call to publicRooms in the case where the number of public rooms is zero, the specific cause is due to xrange trying to use a step value of zero, but if the total room number really is zero then it makes sense to just bail and save the extra processing
-rw-r--r--synapse/handlers/room_list.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/synapse/handlers/room_list.py b/synapse/handlers/room_list.py
index bb40075387..ae5db4d2c5 100644
--- a/synapse/handlers/room_list.py
+++ b/synapse/handlers/room_list.py
@@ -186,6 +186,11 @@ class RoomListHandler(BaseHandler):
         logger.info("After sorting and filtering, %i rooms remain",
                     len(rooms_to_scan))
 
+        #bail if no rooms to work on
+        if len(rooms_to_scan) == 0:
+            defer.returnValue([])
+
+
         # _append_room_entry_to_chunk will append to chunk but will stop if
         # len(chunk) > limit
         #