mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-03 09:34:50 -04:00
Fix up types for the typing handler. (#9638)
By splitting this to two separate methods the callers know what methods they can expect on the handler.
This commit is contained in:
parent
73dbce5523
commit
cc324d53fe
4 changed files with 30 additions and 14 deletions
|
@ -417,9 +417,18 @@ class HomeServer(metaclass=abc.ABCMeta):
|
|||
return PresenceHandler(self)
|
||||
|
||||
@cache_in_self
|
||||
def get_typing_handler(self):
|
||||
def get_typing_writer_handler(self) -> TypingWriterHandler:
|
||||
if self.config.worker.writers.typing == self.get_instance_name():
|
||||
return TypingWriterHandler(self)
|
||||
else:
|
||||
raise Exception("Workers cannot write typing")
|
||||
|
||||
@cache_in_self
|
||||
def get_typing_handler(self) -> FollowerTypingHandler:
|
||||
if self.config.worker.writers.typing == self.get_instance_name():
|
||||
# Use get_typing_writer_handler to ensure that we use the same
|
||||
# cached version.
|
||||
return self.get_typing_writer_handler()
|
||||
else:
|
||||
return FollowerTypingHandler(self)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue