diff --git a/synapse/storage/databases/main/appservice.py b/synapse/storage/databases/main/appservice.py index 06944465582b..c1716e70ffeb 100644 --- a/synapse/storage/databases/main/appservice.py +++ b/synapse/storage/databases/main/appservice.py @@ -446,7 +446,7 @@ def get_type_stream_id_for_appservice_txn(txn): ) last_stream_id = txn.fetchone() if last_stream_id is None or last_stream_id[0] is None: # no row exists - return 0 + return 1 else: return int(last_stream_id[0]) diff --git a/tests/storage/test_appservice.py b/tests/storage/test_appservice.py index ee599f433667..6249eb8c115d 100644 --- a/tests/storage/test_appservice.py +++ b/tests/storage/test_appservice.py @@ -476,12 +476,12 @@ def test_get_type_stream_id_for_appservice_no_value(self) -> None: value = self.get_success( self.store.get_type_stream_id_for_appservice(self.service, "read_receipt") ) - self.assertEqual(value, 0) + self.assertEqual(value, 1) value = self.get_success( self.store.get_type_stream_id_for_appservice(self.service, "presence") ) - self.assertEqual(value, 0) + self.assertEqual(value, 1) def test_get_type_stream_id_for_appservice_invalid_type(self) -> None: self.get_failure(