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
f7e4a582
Commit
f7e4a582
authored
5 years ago
by
Hubert Chathi
Browse files
Options
Downloads
Patches
Plain Diff
clean up code a bit
parent
998f7fe7
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
synapse/replication/slave/storage/devices.py
+9
-5
9 additions, 5 deletions
synapse/replication/slave/storage/devices.py
with
9 additions
and
5 deletions
synapse/replication/slave/storage/devices.py
+
9
−
5
View file @
f7e4a582
...
@@ -15,6 +15,7 @@
...
@@ -15,6 +15,7 @@
from
synapse.replication.slave.storage._base
import
BaseSlavedStore
from
synapse.replication.slave.storage._base
import
BaseSlavedStore
from
synapse.replication.slave.storage._slaved_id_tracker
import
SlavedIdTracker
from
synapse.replication.slave.storage._slaved_id_tracker
import
SlavedIdTracker
from
synapse.replication.tcp.streams._base
import
DeviceListsStream
,
UserSignatureStream
from
synapse.storage.data_stores.main.devices
import
DeviceWorkerStore
from
synapse.storage.data_stores.main.devices
import
DeviceWorkerStore
from
synapse.storage.data_stores.main.end_to_end_keys
import
EndToEndKeyWorkerStore
from
synapse.storage.data_stores.main.end_to_end_keys
import
EndToEndKeyWorkerStore
from
synapse.util.caches.stream_change_cache
import
StreamChangeCache
from
synapse.util.caches.stream_change_cache
import
StreamChangeCache
...
@@ -42,17 +43,20 @@ class SlavedDeviceStore(EndToEndKeyWorkerStore, DeviceWorkerStore, BaseSlavedSto
...
@@ -42,17 +43,20 @@ class SlavedDeviceStore(EndToEndKeyWorkerStore, DeviceWorkerStore, BaseSlavedSto
def
stream_positions
(
self
):
def
stream_positions
(
self
):
result
=
super
(
SlavedDeviceStore
,
self
).
stream_positions
()
result
=
super
(
SlavedDeviceStore
,
self
).
stream_positions
()
result
[
"
user_signature
"
]
=
result
[
# The user signature stream uses the same stream ID generator as the
"
device_lists
"
# device list stream, so set them both to the device list ID
]
=
self
.
_device_list_id_gen
.
get_current_token
()
# generator's current token.
current_token
=
self
.
_device_list_id_gen
.
get_current_token
()
result
[
DeviceListsStream
.
NAME
]
=
current_token
result
[
UserSignatureStream
.
NAME
]
=
current_token
return
result
return
result
def
process_replication_rows
(
self
,
stream_name
,
token
,
rows
):
def
process_replication_rows
(
self
,
stream_name
,
token
,
rows
):
if
stream_name
==
"
d
evice
_l
ists
"
:
if
stream_name
==
D
evice
L
ists
Stream
.
NAME
:
self
.
_device_list_id_gen
.
advance
(
token
)
self
.
_device_list_id_gen
.
advance
(
token
)
for
row
in
rows
:
for
row
in
rows
:
self
.
_invalidate_caches_for_devices
(
token
,
row
.
user_id
,
row
.
destination
)
self
.
_invalidate_caches_for_devices
(
token
,
row
.
user_id
,
row
.
destination
)
elif
stream_name
==
"
u
ser
_s
ignature
"
:
elif
stream_name
==
U
ser
S
ignature
Stream
.
NAME
:
for
row
in
rows
:
for
row
in
rows
:
self
.
_user_signature_stream_cache
.
entity_has_changed
(
row
.
user_id
,
token
)
self
.
_user_signature_stream_cache
.
entity_has_changed
(
row
.
user_id
,
token
)
return
super
(
SlavedDeviceStore
,
self
).
process_replication_rows
(
return
super
(
SlavedDeviceStore
,
self
).
process_replication_rows
(
...
...
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