mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-03 02:04:48 -04:00
Use ijson to parse the response to /send_join
, reducing memory usage. (#9958)
Instead of parsing the full response to `/send_join` into Python objects (which can be huge for large rooms) and *then* parsing that into events, we instead use ijson to stream parse the response directly into `EventBase` objects.
This commit is contained in:
parent
551d2c3f4b
commit
64887f06fc
7 changed files with 228 additions and 59 deletions
|
@ -813,7 +813,12 @@ class _ReadBodyWithMaxSizeProtocol(protocol.Protocol):
|
|||
if self.deferred.called:
|
||||
return
|
||||
|
||||
self.stream.write(data)
|
||||
try:
|
||||
self.stream.write(data)
|
||||
except Exception:
|
||||
self.deferred.errback()
|
||||
return
|
||||
|
||||
self.length += len(data)
|
||||
# The first time the maximum size is exceeded, error and cancel the
|
||||
# connection. dataReceived might be called again if data was received
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue