Fixup review comments

pull/7517/head
Erik Johnston 2020-05-18 12:31:27 +01:00
parent 7ed308a281
commit 266755226b
4 changed files with 6 additions and 4 deletions

View File

@ -94,13 +94,13 @@ class WorkerConfig(Config):
bind_addresses.append("")
# A map from instance name to host/port of their HTTP replication endpoint.
instance_map = config.get("instance_map", {}) or {}
instance_map = config.get("instance_map") or {}
self.instance_map = {
name: InstanceLocationConfig(**c) for name, c in instance_map.items()
}
# Map from type of streams to source, c.f. WriterLocations.
writers = config.get("writers", {}) or {}
writers = config.get("writers") or {}
self.writers = WriterLocations(**writers)
# Check that the configured writer for events also appears in

View File

@ -888,7 +888,7 @@ class EventCreationHandler(object):
"""Called when we have fully built the event, have already
calculated the push actions for the event, and checked auth.
This should only be run on master.
This should only be run on instance in charge of persisting events.
"""
assert self.config.worker.writers.events == self._instance_name

View File

@ -89,6 +89,8 @@ class ReplicationCommandHandler:
self._streams_to_replicate.append(stream)
continue
# Only add EventStream and BackfillStream as a source on the
# instance in charge of event persistence.
if (
isinstance(stream, (EventsStream, BackfillStream))
and hs.config.worker.writers.events == hs.get_instance_name()

View File

@ -67,7 +67,7 @@ class DataStores(object):
self.main = main_store_class(database, db_conn, hs)
# If we're on a process that can persist events also
# instansiate a `PersistEventsStore`
# instantiate a `PersistEventsStore`
if hs.config.worker.writers.events == hs.get_instance_name():
self.persist_events = PersistEventsStore(
hs, database, self.main