mirror of
https://git.anonymousland.org/anonymousland/synapse-product.git
synced 2024-12-24 23:49:22 -05:00
Merge pull request #3079 from matrix-org/erikj/limit_concurrent_sends
Limit concurrent event sends for a room
This commit is contained in:
commit
eaa2ebf20b
@ -454,7 +454,6 @@ class EventCreationHandler(object):
|
|||||||
"""
|
"""
|
||||||
builder = self.event_builder_factory.new(event_dict)
|
builder = self.event_builder_factory.new(event_dict)
|
||||||
|
|
||||||
with (yield self.limiter.queue(builder.room_id)):
|
|
||||||
self.validator.validate_new(builder)
|
self.validator.validate_new(builder)
|
||||||
|
|
||||||
if builder.type == EventTypes.Member:
|
if builder.type == EventTypes.Member:
|
||||||
@ -557,6 +556,13 @@ class EventCreationHandler(object):
|
|||||||
|
|
||||||
See self.create_event and self.send_nonmember_event.
|
See self.create_event and self.send_nonmember_event.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
# We limit the number of concurrent event sends in a room so that we
|
||||||
|
# don't fork the DAG too much. If we don't limit then we can end up in
|
||||||
|
# a situation where event persistence can't keep up, causing
|
||||||
|
# extremities to pile up, which in turn leads to state resolution
|
||||||
|
# taking longer.
|
||||||
|
with (yield self.limiter.queue(event_dict["room_id"])):
|
||||||
event, context = yield self.create_event(
|
event, context = yield self.create_event(
|
||||||
requester,
|
requester,
|
||||||
event_dict,
|
event_dict,
|
||||||
|
@ -165,17 +165,12 @@ class RoomStateEventRestServlet(ClientV1RestServlet):
|
|||||||
content=content,
|
content=content,
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
event, context = yield self.event_creation_hander.create_event(
|
event = yield self.event_creation_hander.create_and_send_nonmember_event(
|
||||||
requester,
|
requester,
|
||||||
event_dict,
|
event_dict,
|
||||||
token_id=requester.access_token_id,
|
|
||||||
txn_id=txn_id,
|
txn_id=txn_id,
|
||||||
)
|
)
|
||||||
|
|
||||||
yield self.event_creation_hander.send_nonmember_event(
|
|
||||||
requester, event, context,
|
|
||||||
)
|
|
||||||
|
|
||||||
ret = {}
|
ret = {}
|
||||||
if event:
|
if event:
|
||||||
ret = {"event_id": event.event_id}
|
ret = {"event_id": event.event_id}
|
||||||
|
Loading…
Reference in New Issue
Block a user