Timeout Linearizer

This commit is contained in:
Erik Johnston
2025-06-25 13:35:03 +01:00
parent 4247fa48b5
commit 6002debbde
2 changed files with 16 additions and 3 deletions

View File

@@ -76,7 +76,13 @@ from synapse.types import (
create_requester,
)
from synapse.types.state import StateFilter
from synapse.util import json_decoder, json_encoder, log_failure, unwrapFirstError
from synapse.util import (
Duration,
json_decoder,
json_encoder,
log_failure,
unwrapFirstError,
)
from synapse.util.async_helpers import Linearizer, gather_results
from synapse.util.caches.expiringcache import ExpiringCache
from synapse.util.metrics import measure_func
@@ -506,7 +512,13 @@ class EventCreationHandler:
# We limit concurrent event creation for a room to 1. This prevents state resolution
# from occurring when sending bursts of events to a local room
self.limiter = Linearizer(max_count=1, name="room_event_creation_limit")
self.limiter = Linearizer(
max_count=1,
name="room_event_creation_limit",
# We timeout queued requests after 90 seconds, as the client will
# likely have timed out by then.
timeout=90 * Duration.SECOND_MS,
)
self._bulk_push_rule_evaluator = hs.get_bulk_push_rule_evaluator()

View File

@@ -59,7 +59,8 @@ class Duration:
"""Helper class that holds constants for common time durations in
milliseconds."""
MINUTE_MS = 60 * 1000
SECOND_MS = 1000
MINUTE_MS = 60 * SECOND_MS
HOUR_MS = 60 * MINUTE_MS
DAY_MS = 24 * HOUR_MS