summary refs log tree commit diff
path: root/synapse/storage/util/sequence.py
diff options
context:
space:
mode:
authorAndrew Morgan <andrew@amorgan.xyz>2021-04-22 19:04:59 +0100
committerAndrew Morgan <andrew@amorgan.xyz>2021-04-22 19:04:59 +0100
commitd8df16e331b1964287dcaa31b4dea5abb19a42f9 (patch)
treeb7775a50db4edb07c1b21717f06324d72cde1bd0 /synapse/storage/util/sequence.py
parentMerge commit '5a9cdaa6e' into anoa/dinsic_release_1_31_0 (diff)
parentType hints and validation improvements. (#9321) (diff)
downloadsynapse-d8df16e331b1964287dcaa31b4dea5abb19a42f9.tar.xz
Merge commit '3f58fc848' into anoa/dinsic_release_1_31_0
Diffstat (limited to 'synapse/storage/util/sequence.py')
-rw-r--r--synapse/storage/util/sequence.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/synapse/storage/util/sequence.py b/synapse/storage/util/sequence.py

index 0ec4dc2918..e2b316a218 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( @@ -147,7 +149,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