Repository: matrix-org/synapse

Issue:
AttributeError: 'ServerReplicationStreamProtocol' object has no attribute 'replication_streams'
### Description
Using the latest dev build I am getting several of these errors in the homeserver.log
```
2020-03-31 18:02:31,862 - synapse.replication.tcp.protocol - 163 - INFO -  - [anon-dQsVA] Connection established
2020-03-31 18:02:31,880 - synapse.replication.tcp.protocol - 421 - INFO - replication-NAME-10 - [anon-dQsVA] Renamed to 'synapse.app.appservice'
2020-03-31 18:02:32,915 - synapse.metrics - 76 - ERROR -  - Exception running callback for LaterGauge(synapse_replication_tcp_resource_connections_per_stream)
Traceback (most recent call last):
  File "/opt/synapse/synapse/synapse/metrics/__init__.py", line 74, in collect
    calls = self.caller()
  File "/opt/synapse/synapse/synapse/replication/tcp/resource.py", line 114, in <lambda>
    for stream_name in self.streams_by_name
  File "/opt/synapse/synapse/synapse/replication/tcp/resource.py", line 114, in <dictcomp>
    for stream_name in self.streams_by_name
  File "/opt/synapse/synapse/synapse/replication/tcp/resource.py", line 111, in <listcomp>
    if stream_name in conn.replication_streams
AttributeError: 'ServerReplicationStreamProtocol' object has no attribute 'replication_streams'
2020-03-31 18:02:37,707 - synapse.replication.tcp.protocol - 163 - INFO -  - [anon-zCRCR] Connection established
2020-03-31 18:02:37,723 - synapse.replication.tcp.protocol - 421 - INFO - replication-NAME-11 - [anon-zCRCR] Renamed to 'synapse.app.client_reader'
2020-03-31 18:02:43,427 - synapse.replication.tcp.protocol - 163 - INFO -  - [anon-NHvgG] Connection established
2020-03-31 18:02:43,464 - synapse.replication.tcp.protocol - 421 - INFO - replication-NAME-12 - [anon-NHvgG] Renamed to 'synapse.app.synchrotron'
2020-03-31 18:02:47,925 - synapse.metrics - 76 - ERROR -  - Exception running callback for LaterGauge(synapse_replication_tcp_resource_connections_per_stream)
Traceback (most recent call last):
  File "/opt/synapse/synapse/synapse/metrics/__init__.py", line 74, in collect
    calls = self.caller()
  File "/opt/synapse/synapse/synapse/replication/tcp/resource.py", line 114, in <lambda>
    for stream_name in self.streams_by_name
  File "/opt/synapse/synapse/synapse/replication/tcp/resource.py", line 114, in <dictcomp>
    for stream_name in self.streams_by_name
  File "/opt/synapse/synapse/synapse/replication/tcp/resource.py", line 111, in <listcomp>
    if stream_name in conn.replication_streams
AttributeError: 'ServerReplicationStreamProtocol' object has no attribute 'replication_streams'
2020-03-31 18:02:49,166 - synapse.replication.tcp.protocol - 163 - INFO -  - [anon-ZGMih] Connection established
```

### Steps to reproduce

- download latest dev build
- using a worker environment
- start homeserver and check log



### Version information

<!-- IMPORTANT: please answer the following questions, to help us narrow down the problem -->

<!-- Was this issue identified on matrix.org or another homeserver? -->
- **Version**:
homeserver.py version 1.12.0 (b=develop,2e826cd80)
Twisted is 20.3.0 (in case that matters)
- **Install method**:
git pull
- **Platform**:
Debian 9, ARM64



Discussion:
broken by #7024 presumably

Resolving patch:
diff --git a/synapse/replication/tcp/resource.py b/synapse/replication/tcp/resource.py
--- a/synapse/replication/tcp/resource.py
+++ b/synapse/replication/tcp/resource.py
@@ -99,22 +99,6 @@ def __init__(self, hs):
 
         self.streams_by_name = {stream.NAME: stream for stream in self.streams}
 
-        LaterGauge(
-            "synapse_replication_tcp_resource_connections_per_stream",
-            "",
-            ["stream_name"],
-            lambda: {
-                (stream_name,): len(
-                    [
-                        conn
-                        for conn in self.connections
-                        if stream_name in conn.replication_streams
-                    ]
-                )
-                for stream_name in self.streams_by_name
-            },
-        )
-
         self.federation_sender = None
         if not hs.config.send_federation:
             self.federation_sender = hs.get_federation_sender()


Test patch: