Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
synapse
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Timo Ley
synapse
Commits
68ebb81e
Commit
68ebb81e
authored
9 years ago
by
Erik Johnston
Browse files
Options
Downloads
Plain Diff
Merge pull request #740 from matrix-org/erikj/state_cache
Always use state cache entry if it exists
parents
4cf43205
5bbc3215
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
synapse/state.py
+10
-3
10 additions, 3 deletions
synapse/state.py
with
10 additions
and
3 deletions
synapse/state.py
+
10
−
3
View file @
68ebb81e
...
...
@@ -214,7 +214,7 @@ class StateHandler(object):
if
self
.
_state_cache
is
not
None
:
cache
=
self
.
_state_cache
.
get
(
group_names
,
None
)
if
cache
and
cache
.
state_group
:
if
cache
:
cache
.
ts
=
self
.
clock
.
time_msec
()
event_dict
=
yield
self
.
store
.
get_events
(
cache
.
state
.
values
())
...
...
@@ -236,16 +236,23 @@ class StateHandler(object):
state_groups
.
values
(),
event_type
,
state_key
)
state_group
=
None
new_state_event_ids
=
frozenset
(
e
.
event_id
for
e
in
new_state
.
values
())
for
sg
,
events
in
state_groups
.
items
():
if
new_state_event_ids
==
frozenset
(
e
.
event_id
for
e
in
events
):
state_group
=
sg
break
if
self
.
_state_cache
is
not
None
:
cache
=
_StateCacheEntry
(
state
=
{
key
:
event
.
event_id
for
key
,
event
in
new_state
.
items
()},
state_group
=
None
,
state_group
=
state_group
,
ts
=
self
.
clock
.
time_msec
()
)
self
.
_state_cache
[
group_names
]
=
cache
defer
.
returnValue
((
None
,
new_state
,
prev_states
))
defer
.
returnValue
((
state_group
,
new_state
,
prev_states
))
def
resolve_events
(
self
,
state_sets
,
event
):
logger
.
info
(
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment