summary refs log tree commit diff
path: root/stubs
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2021-01-26 10:54:54 +0000
committerGitHub <noreply@github.com>2021-01-26 10:54:54 +0000
commita1ff1e967fb94411e806f69e6f026263be7a6790 (patch)
tree08f13568aa2c95f23f7b55042bc8d2dbb5dd0b82 /stubs
parentDon't error if deleting a non-existent pusher. (#9121) (diff)
downloadsynapse-a1ff1e967fb94411e806f69e6f026263be7a6790.tar.xz
Periodically send pings to detect dead Redis connections (#9218)
This is done by creating a custom `RedisFactory` subclass that
periodically pings all connections in its pool.

We also ensure that the `replyTimeout` param is non-null, so that we
timeout waiting for the reply to those pings (and thus triggering a
reconnect).
Diffstat (limited to 'stubs')
-rw-r--r--stubs/txredisapi.pyi12
1 files changed, 8 insertions, 4 deletions
diff --git a/stubs/txredisapi.pyi b/stubs/txredisapi.pyi
index 726454ba31..bdc892ec82 100644
--- a/stubs/txredisapi.pyi
+++ b/stubs/txredisapi.pyi
@@ -19,8 +19,9 @@ from typing import List, Optional, Type, Union
 
 class RedisProtocol:
     def publish(self, channel: str, message: bytes): ...
+    async def ping(self) -> None: ...
 
-class SubscriberProtocol:
+class SubscriberProtocol(RedisProtocol):
     def __init__(self, *args, **kwargs): ...
     password: Optional[str]
     def subscribe(self, channels: Union[str, List[str]]): ...
@@ -39,14 +40,13 @@ def lazyConnection(
     convertNumbers: bool = ...,
 ) -> RedisProtocol: ...
 
-class SubscriberFactory:
-    def buildProtocol(self, addr): ...
-
 class ConnectionHandler: ...
 
 class RedisFactory:
     continueTrying: bool
     handler: RedisProtocol
+    pool: List[RedisProtocol]
+    replyTimeout: Optional[int]
     def __init__(
         self,
         uuid: str,
@@ -59,3 +59,7 @@ class RedisFactory:
         replyTimeout: Optional[int] = None,
         convertNumbers: Optional[int] = True,
     ): ...
+    def buildProtocol(self, addr) -> RedisProtocol: ...
+
+class SubscriberFactory(RedisFactory):
+    def __init__(self): ...