Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
lints
Browse files Browse the repository at this point in the history
  • Loading branch information
H-Shay committed Jan 26, 2023
1 parent b1b3d99 commit 9ff81b3
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
1 change: 0 additions & 1 deletion synapse/handlers/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -721,7 +721,6 @@ async def create_event(
current_state_group=current_state_group,
)


# In an ideal world we wouldn't need the second part of this condition. However,
# this behaviour isn't spec'd yet, meaning we should be able to deactivate this
# behaviour. Another reason is that this code is also evaluated each time a new
Expand Down
21 changes: 17 additions & 4 deletions synapse/storage/databases/state/store.py
Original file line number Diff line number Diff line change
Expand Up @@ -460,12 +460,16 @@ def insert_deltas_group_txn(
# The first prev_group will be the last persisted state group, which is passed in
# else it will be the group most recently assigned
if index > 0:
context.prev_group_for_state_group_after_event = state_groups[index - 1]
context.prev_group_for_state_group_after_event = state_groups[
index - 1
]
context.state_group_before_event = state_groups[index - 1]
else:
context.prev_group_for_state_group_after_event = prev_group
context.state_group_before_event = prev_group
context.delta_ids_to_state_group_after_event = {(event.type, event.state_key): event.event_id}
context.delta_ids_to_state_group_after_event = {
(event.type, event.state_key): event.event_id
}
context.state_delta_due_to_event = {
(event.type, event.state_key): event.event_id
}
Expand All @@ -486,7 +490,10 @@ def insert_deltas_group_txn(
table="state_group_edges",
keys=("state_group", "prev_state_group"),
values=[
(context.state_group_after_event, context.prev_group_for_state_group_after_event)
(
context.state_group_after_event,
context.prev_group_for_state_group_after_event,
)
for _, context in events_and_context
],
)
Expand All @@ -498,7 +505,13 @@ def insert_deltas_group_txn(
table="state_groups_state",
keys=("state_group", "room_id", "type", "state_key", "event_id"),
values=[
(context.state_group_after_event, room_id, key[0], key[1], state_id)
(
context.state_group_after_event,
room_id,
key[0],
key[1],
state_id,
)
for key, state_id in context.delta_ids_to_state_group_after_event.items()
],
)
Expand Down

0 comments on commit 9ff81b3

Please sign in to comment.