summary refs log tree commit diff
path: root/synapse/storage/util/sequence.py
diff options
context:
space:
mode:
authorRichard van der Hoff <richard@matrix.org>2021-02-17 16:31:57 +0000
committerRichard van der Hoff <richard@matrix.org>2021-02-17 16:31:57 +0000
commit7b7831bb6363a625c97446298838c66abfeb6b8b (patch)
tree39ec72cc7b8985858012f5d77fb89796fb04ff43 /synapse/storage/util/sequence.py
parentEnsure that we never stop reconnecting to redis (#9391) (diff)
parentReorganize CONTRIBUTING.md documentation. (#9281) (diff)
downloadsynapse-7b7831bb6363a625c97446298838c66abfeb6b8b.tar.xz
Merge remote-tracking branch 'origin/develop' into matrix-org-hotfixes
Diffstat (limited to 'synapse/storage/util/sequence.py')
-rw-r--r--synapse/storage/util/sequence.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/synapse/storage/util/sequence.py b/synapse/storage/util/sequence.py

index 0ec4dc2918..3ea637b281 100644 --- a/synapse/storage/util/sequence.py +++ b/synapse/storage/util/sequence.py
@@ -106,7 +106,9 @@ class PostgresSequenceGenerator(SequenceGenerator): def get_next_id_txn(self, txn: Cursor) -> int: txn.execute("SELECT nextval(?)", (self._sequence_name,)) - return txn.fetchone()[0] + fetch_res = txn.fetchone() + assert fetch_res is not None + return fetch_res[0] def get_next_mult_txn(self, txn: Cursor, n: int) -> List[int]: txn.execute( @@ -122,8 +124,7 @@ class PostgresSequenceGenerator(SequenceGenerator): stream_name: Optional[str] = None, positive: bool = True, ): - """See SequenceGenerator.check_consistency for docstring. - """ + """See SequenceGenerator.check_consistency for docstring.""" txn = db_conn.cursor(txn_name="sequence.check_consistency") @@ -147,7 +148,9 @@ class PostgresSequenceGenerator(SequenceGenerator): txn.execute( "SELECT last_value, is_called FROM %(seq)s" % {"seq": self._sequence_name} ) - last_value, is_called = txn.fetchone() + fetch_res = txn.fetchone() + assert fetch_res is not None + last_value, is_called = fetch_res # If we have an associated stream check the stream_positions table. max_in_stream_positions = None