Split different RDATA
streams into different redis channels #12461
Description
Similar to #12460, we should have a separate pub/sub channel for each RDATA
stream so that workers only need to subscribe to the channels they actually need.
This is a bit tricky to do safely, i.e. that workers do correctly subscribe to streams they need, especially for caching purposes. I think the best approach is instead of having the replication client call into the various handlers and storage classes:
synapse/synapse/replication/tcp/client.py
Lines 134 to 148 in e3a49f4
instead each class registers with the replication client in their __init__
each stream they care about with a callback to handle that particular streams rows. That way a worker only subscribes to a stream if a class that requires is actually instantiated.
The downside of this is that it's a bit magic, and pulling in a class can have the side effect of causing a stream to suddenly be subscribed to.