Apply suggestions from code review

Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
pull/8439/head
Erik Johnston 2020-10-06 09:59:02 +01:00 committed by GitHub
parent 2067dc7b0f
commit f709da9e05
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View File

@ -17,9 +17,9 @@
-- A unique and immutable mapping between instance name and an integer ID. This
-- lets us refer to instances via a small ID in e.g. stream tokens, without
-- having to encode the full name.
CREATE TABLE instance_map (
CREATE TABLE IF NOT EXISTS instance_map (
instance_id SERIAL PRIMARY KEY,
instance_name TEXT NOT NULL
);
CREATE UNIQUE INDEX instance_map_idx ON instance_map(instance_name);
CREATE UNIQUE INDEX IF NOT EXISTS instance_map_idx ON instance_map(instance_name);

View File

@ -1226,7 +1226,7 @@ class StreamWorkerStore(EventsWorkerStore, SQLBaseStore, metaclass=abc.ABCMeta):
@cached()
async def get_id_for_instance(self, instance_name: str) -> int:
"""Get a unique, immutable ID that corresponds to the instance.
"""Get a unique, immutable ID that corresponds to the given Synapse worker instance.
"""
def _get_id_for_instance_txn(txn):