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
Container registry
Model registry
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
Maunium
synapse
Commits
831b31e5
Unverified
Commit
831b31e5
authored
4 years ago
by
Erik Johnston
Committed by
GitHub
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Add another yield point to state res v2 (#7746)
parent
177b2d0c
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
changelog.d/7746.bugfix
+1
-0
1 addition, 0 deletions
changelog.d/7746.bugfix
synapse/state/v2.py
+10
-2
10 additions, 2 deletions
synapse/state/v2.py
with
11 additions
and
2 deletions
changelog.d/7746.bugfix
0 → 100644
+
1
−
0
View file @
831b31e5
Fix large state resolutions from stalling Synapse for seconds at a time.
This diff is collapsed.
Click to expand it.
synapse/state/v2.py
+
10
−
2
View file @
831b31e5
...
@@ -126,6 +126,7 @@ def resolve_events_with_store(
...
@@ -126,6 +126,7 @@ def resolve_events_with_store(
# Now sequentially auth each one
# Now sequentially auth each one
resolved_state
=
yield
_iterative_auth_checks
(
resolved_state
=
yield
_iterative_auth_checks
(
clock
,
room_id
,
room_id
,
room_version
,
room_version
,
sorted_power_events
,
sorted_power_events
,
...
@@ -154,6 +155,7 @@ def resolve_events_with_store(
...
@@ -154,6 +155,7 @@ def resolve_events_with_store(
logger
.
debug
(
"
resolving remaining events
"
)
logger
.
debug
(
"
resolving remaining events
"
)
resolved_state
=
yield
_iterative_auth_checks
(
resolved_state
=
yield
_iterative_auth_checks
(
clock
,
room_id
,
room_id
,
room_version
,
room_version
,
leftover_events
,
leftover_events
,
...
@@ -378,12 +380,13 @@ def _reverse_topological_power_sort(
...
@@ -378,12 +380,13 @@ def _reverse_topological_power_sort(
@defer.inlineCallbacks
@defer.inlineCallbacks
def
_iterative_auth_checks
(
def
_iterative_auth_checks
(
room_id
,
room_version
,
event_ids
,
base_state
,
event_map
,
state_res_store
clock
,
room_id
,
room_version
,
event_ids
,
base_state
,
event_map
,
state_res_store
):
):
"""
Sequentially apply auth checks to each event in given list, updating the
"""
Sequentially apply auth checks to each event in given list, updating the
state as it goes along.
state as it goes along.
Args:
Args:
clock (Clock)
room_id (str)
room_id (str)
room_version (str)
room_version (str)
event_ids (list[str]): Ordered list of events to apply auth checks to
event_ids (list[str]): Ordered list of events to apply auth checks to
...
@@ -397,7 +400,7 @@ def _iterative_auth_checks(
...
@@ -397,7 +400,7 @@ def _iterative_auth_checks(
resolved_state
=
base_state
.
copy
()
resolved_state
=
base_state
.
copy
()
room_version_obj
=
KNOWN_ROOM_VERSIONS
[
room_version
]
room_version_obj
=
KNOWN_ROOM_VERSIONS
[
room_version
]
for
event_id
in
e
vent_ids
:
for
idx
,
event_id
in
e
numerate
(
event_ids
,
start
=
1
)
:
event
=
event_map
[
event_id
]
event
=
event_map
[
event_id
]
auth_events
=
{}
auth_events
=
{}
...
@@ -435,6 +438,11 @@ def _iterative_auth_checks(
...
@@ -435,6 +438,11 @@ def _iterative_auth_checks(
except
AuthError
:
except
AuthError
:
pass
pass
# We yield occasionally when we're working with large data sets to
# ensure that we don't block the reactor loop for too long.
if
idx
%
_YIELD_AFTER_ITERATIONS
==
0
:
yield
clock
.
sleep
(
0
)
return
resolved_state
return
resolved_state
...
...
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