|
38 | 38 | whitelisted_homeserver,
|
39 | 39 | )
|
40 | 40 | from synapse.metrics.background_process_metrics import wrap_as_background_process
|
41 |
| -from synapse.replication.slave.storage._slaved_id_tracker import SlavedIdTracker |
42 | 41 | from synapse.replication.tcp.streams._base import DeviceListsStream, UserSignatureStream
|
43 | 42 | from synapse.storage._base import SQLBaseStore, db_to_json, make_in_list_sql_clause
|
44 | 43 | from synapse.storage.database import (
|
@@ -86,28 +85,19 @@ def __init__(
|
86 | 85 | ):
|
87 | 86 | super().__init__(database, db_conn, hs)
|
88 | 87 |
|
89 |
| - if hs.config.worker.worker_app is None: |
90 |
| - self._device_list_id_gen: AbstractStreamIdTracker = StreamIdGenerator( |
91 |
| - db_conn, |
92 |
| - "device_lists_stream", |
93 |
| - "stream_id", |
94 |
| - extra_tables=[ |
95 |
| - ("user_signature_stream", "stream_id"), |
96 |
| - ("device_lists_outbound_pokes", "stream_id"), |
97 |
| - ("device_lists_changes_in_room", "stream_id"), |
98 |
| - ], |
99 |
| - ) |
100 |
| - else: |
101 |
| - self._device_list_id_gen = SlavedIdTracker( |
102 |
| - db_conn, |
103 |
| - "device_lists_stream", |
104 |
| - "stream_id", |
105 |
| - extra_tables=[ |
106 |
| - ("user_signature_stream", "stream_id"), |
107 |
| - ("device_lists_outbound_pokes", "stream_id"), |
108 |
| - ("device_lists_changes_in_room", "stream_id"), |
109 |
| - ], |
110 |
| - ) |
| 88 | + # In the worker store this is an ID tracker which we overwrite in the non-worker |
| 89 | + # class below that is used on the main process. |
| 90 | + self._device_list_id_gen: AbstractStreamIdTracker = StreamIdGenerator( |
| 91 | + db_conn, |
| 92 | + "device_lists_stream", |
| 93 | + "stream_id", |
| 94 | + extra_tables=[ |
| 95 | + ("user_signature_stream", "stream_id"), |
| 96 | + ("device_lists_outbound_pokes", "stream_id"), |
| 97 | + ("device_lists_changes_in_room", "stream_id"), |
| 98 | + ], |
| 99 | + is_writer=hs.config.worker.worker_app is None, |
| 100 | + ) |
111 | 101 |
|
112 | 102 | # Type-ignore: _device_list_id_gen is mixed in from either DataStore (as a
|
113 | 103 | # StreamIdGenerator) or SlavedDataStore (as a SlavedIdTracker).
|
|
0 commit comments