Compare commits

...

4 Commits

Author SHA1 Message Date
Richard van der Hoff
311c15dd4f put a cache on /state_ids 2020-07-18 22:18:42 +01:00
Richard van der Hoff
6d174fda89 Merge tag 'v1.17.0-mod1' into rav/modular_hacks 2020-07-18 20:47:56 +01:00
Richard van der Hoff
75da9f7a8e Abort requests if the client disconnects early 2020-07-18 20:01:03 +01:00
Jason Robinson
7078251569 Don't fail start on non-C locale postgres database
Instead just warn. This is a temporary workaround to allow
provisioning new Modular hosts.

See https://github.com/matrix-org/synapse/pull/6734
and https://github.com/matrix-org/synapse/issues/6696#issuecomment-575280941

Signed-off-by: Jason Robinson <jasonr@matrix.org>
2020-07-13 11:31:34 +01:00
3 changed files with 18 additions and 3 deletions

View File

@@ -95,6 +95,9 @@ class FederationServer(FederationBase):
# We cache responses to state queries, as they take a while and often
# come in waves.
self._state_resp_cache = ResponseCache(hs, "state_resp", timeout_ms=30000)
self._state_ids_resp_cache = ResponseCache(
hs, "state_ids_resp", timeout_ms=30000
)
async def on_backfill_request(
self, origin: str, room_id: str, versions: List[str], limit: int
@@ -362,10 +365,16 @@ class FederationServer(FederationBase):
if not in_room:
raise AuthError(403, "Host not in room.")
resp = await self._state_ids_resp_cache.wrap(
(room_id, event_id), self._on_state_ids_request_compute, room_id, event_id,
)
return 200, resp
async def _on_state_ids_request_compute(self, room_id, event_id):
state_ids = await self.handler.get_state_ids_for_pdu(room_id, event_id)
auth_chain_ids = await self.store.get_auth_chain_ids(state_ids)
return 200, {"pdu_ids": state_ids, "auth_chain_ids": auth_chain_ids}
return {"pdu_ids": state_ids, "auth_chain_ids": auth_chain_ids}
async def _on_context_state_request_compute(
self, room_id: str, event_id: str

View File

@@ -340,6 +340,12 @@ class BaseFederationServlet(object):
if origin:
with ratelimiter.ratelimit(origin) as d:
await d
if request._disconnected:
logger.warning(
"client disconnected before we started processing "
"request"
)
return -1, None
response = await func(
origin, content, request.args, *args, **kwargs
)

View File

@@ -95,7 +95,7 @@ class PostgresEngine(BaseDatabaseEngine):
errors.append(" - 'CTYPE' is set to %r. Should be 'C'" % (ctype,))
if errors:
raise IncorrectDatabaseSetup(
logger.warning(
"Database is incorrectly configured:\n\n%s\n\n"
"See docs/postgres.md for more information." % ("\n".join(errors))
)