Add type hints for most HomeServer parameters (#11095)

This commit is contained in:
Sean Quah 2021-10-22 18:15:41 +01:00 committed by GitHub
parent b9ce53e878
commit 2b82ec425f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
58 changed files with 342 additions and 143 deletions

View file

@ -800,9 +800,14 @@ class HomeServer(metaclass=abc.ABCMeta):
return ExternalCache(self)
@cache_in_self
def get_outbound_redis_connection(self) -> Optional["RedisProtocol"]:
if not self.config.redis.redis_enabled:
return None
def get_outbound_redis_connection(self) -> "RedisProtocol":
"""
The Redis connection used for replication.
Raises:
AssertionError: if Redis is not enabled in the homeserver config.
"""
assert self.config.redis.redis_enabled
# We only want to import redis module if we're using it, as we have
# `txredisapi` as an optional dependency.