forked from MirrorHub/synapse
Linearize state resolution to help caches
This commit is contained in:
parent
265d847ffd
commit
051a9ea921
1 changed files with 59 additions and 56 deletions
|
@ -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 a new issue