mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-04 11:14:49 -04:00
Add type hints for most HomeServer
parameters (#11095)
This commit is contained in:
parent
b9ce53e878
commit
2b82ec425f
58 changed files with 342 additions and 143 deletions
|
@ -16,6 +16,7 @@
|
|||
|
||||
import logging
|
||||
import random
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from prometheus_client import Counter
|
||||
|
||||
|
@ -27,6 +28,9 @@ from synapse.replication.tcp.protocol import ServerReplicationStreamProtocol
|
|||
from synapse.replication.tcp.streams import EventsStream
|
||||
from synapse.util.metrics import Measure
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from synapse.server import HomeServer
|
||||
|
||||
stream_updates_counter = Counter(
|
||||
"synapse_replication_tcp_resource_stream_updates", "", ["stream_name"]
|
||||
)
|
||||
|
@ -37,7 +41,7 @@ logger = logging.getLogger(__name__)
|
|||
class ReplicationStreamProtocolFactory(Factory):
|
||||
"""Factory for new replication connections."""
|
||||
|
||||
def __init__(self, hs):
|
||||
def __init__(self, hs: "HomeServer"):
|
||||
self.command_handler = hs.get_tcp_replication()
|
||||
self.clock = hs.get_clock()
|
||||
self.server_name = hs.config.server.server_name
|
||||
|
@ -65,7 +69,7 @@ class ReplicationStreamer:
|
|||
data is available it will propagate to all connected clients.
|
||||
"""
|
||||
|
||||
def __init__(self, hs):
|
||||
def __init__(self, hs: "HomeServer"):
|
||||
self.store = hs.get_datastore()
|
||||
self.clock = hs.get_clock()
|
||||
self.notifier = hs.get_notifier()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue