summary refs log tree commit diff
diff options
context:
space:
mode:
authorAndrew Morgan <andrewm@element.io>2022-03-09 15:49:02 +0000
committerAndrew Morgan <andrewm@element.io>2022-03-09 17:27:52 +0000
commit4b6711803d98cd70211b85bddbbac2294bfdd080 (patch)
treeebec290ad14abc520903ff183a7367093d85ece6
parentUpdate client-visibility filtering for outlier events (#12155) (diff)
downloadsynapse-4b6711803d98cd70211b85bddbbac2294bfdd080.tar.xz
Set min application service stream_id to 1
Factored out into #12193.
-rw-r--r--synapse/storage/databases/main/appservice.py2
-rw-r--r--tests/storage/test_appservice.py4
2 files changed, 3 insertions, 3 deletions
diff --git a/synapse/storage/databases/main/appservice.py b/synapse/storage/databases/main/appservice.py
index 0694446558..c1716e70ff 100644
--- a/synapse/storage/databases/main/appservice.py
+++ b/synapse/storage/databases/main/appservice.py
@@ -446,7 +446,7 @@ class ApplicationServiceTransactionWorkerStore(
             )
             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 ee599f4336..6249eb8c11 100644
--- a/tests/storage/test_appservice.py
+++ b/tests/storage/test_appservice.py
@@ -476,12 +476,12 @@ class ApplicationServiceStoreTypeStreamIds(unittest.HomeserverTestCase):
         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(