Merge pull request #5851 from matrix-org/rei/roomdir_maybedeferred

Room Directory:  Wrap `get_local_public_room_list` call in `maybeDeferred`
This commit is contained in:
reivilibre 2019-08-15 11:02:33 +01:00 committed by GitHub
commit 7809f0c022
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 2 deletions

2
changelog.d/5851.bugfix Normal file
View File

@ -0,0 +1,2 @@
Fix 500 Internal Server Error on `publicRooms` when the public room list was
cached.

View File

@ -19,6 +19,8 @@ import functools
import logging import logging
import re import re
from twisted.internet.defer import maybeDeferred
import synapse import synapse
import synapse.logging.opentracing as opentracing import synapse.logging.opentracing as opentracing
from synapse.api.errors import Codes, FederationDeniedError, SynapseError from synapse.api.errors import Codes, FederationDeniedError, SynapseError
@ -745,8 +747,12 @@ class PublicRoomList(BaseFederationServlet):
else: else:
network_tuple = ThirdPartyInstanceID(None, None) network_tuple = ThirdPartyInstanceID(None, None)
data = await self.handler.get_local_public_room_list( data = await maybeDeferred(
limit, since_token, network_tuple=network_tuple, from_federation=True self.handler.get_local_public_room_list,
limit,
since_token,
network_tuple=network_tuple,
from_federation=True,
) )
return 200, data return 200, data