mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-02 08:56:04 -04:00
Allow moving typing off master (#7869)
This commit is contained in:
parent
649a7ead5c
commit
f2e38ca867
10 changed files with 282 additions and 176 deletions
|
@ -42,6 +42,7 @@ from synapse.replication.tcp.streams import (
|
|||
EventsStream,
|
||||
FederationStream,
|
||||
Stream,
|
||||
TypingStream,
|
||||
)
|
||||
from synapse.util.async_helpers import Linearizer
|
||||
|
||||
|
@ -96,6 +97,14 @@ class ReplicationCommandHandler:
|
|||
|
||||
continue
|
||||
|
||||
if isinstance(stream, TypingStream):
|
||||
# Only add TypingStream as a source on the instance in charge of
|
||||
# typing.
|
||||
if hs.config.worker.writers.typing == hs.get_instance_name():
|
||||
self._streams_to_replicate.append(stream)
|
||||
|
||||
continue
|
||||
|
||||
# Only add any other streams if we're on master.
|
||||
if hs.config.worker_app is not None:
|
||||
continue
|
||||
|
|
|
@ -294,11 +294,12 @@ class TypingStream(Stream):
|
|||
def __init__(self, hs):
|
||||
typing_handler = hs.get_typing_handler()
|
||||
|
||||
if hs.config.worker_app is None:
|
||||
# on the master, query the typing handler
|
||||
writer_instance = hs.config.worker.writers.typing
|
||||
if writer_instance == hs.get_instance_name():
|
||||
# On the writer, query the typing handler
|
||||
update_function = typing_handler.get_all_typing_updates
|
||||
else:
|
||||
# Query master process
|
||||
# Query the typing writer process
|
||||
update_function = make_http_update_function(hs, self.NAME)
|
||||
|
||||
super().__init__(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue