mirror of
https://git.anonymousland.org/anonymousland/synapse-product.git
synced 2024-09-08 12:12:44 +00:00
Linearize state resolution to help caches
This commit is contained in:
parent
265d847ffd
commit
051a9ea921
@ -23,6 +23,7 @@ from synapse.api.constants import EventTypes
|
||||
from synapse.api.errors import AuthError
|
||||
from synapse.api.auth import AuthEventTypes
|
||||
from synapse.events.snapshot import EventContext
|
||||
from synapse.util.async import Linearizer
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
@ -84,6 +85,7 @@ class StateHandler(object):
|
||||
|
||||
# dict of set of event_ids -> _StateCacheEntry.
|
||||
self._state_cache = None
|
||||
self.resolve_linearizer = Linearizer()
|
||||
|
||||
def start_caching(self):
|
||||
logger.debug("start_caching")
|
||||
@ -283,6 +285,7 @@ class StateHandler(object):
|
||||
state_group=name,
|
||||
))
|
||||
|
||||
with (yield self.resolve_linearizer.queue(group_names)):
|
||||
if self._state_cache is not None:
|
||||
cache = self._state_cache.get(group_names, None)
|
||||
if cache:
|
||||
|
Loading…
Reference in New Issue
Block a user