Remove code which updates application_services_state.last_txn (#12680)

This column is unused as of #12209, so let's stop writing to it.
This commit is contained in:
Richard van der Hoff 2022-05-17 12:07:18 +02:00 committed by GitHub
parent a34a41f135
commit 24b590de32
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 35 additions and 55 deletions

View file

@ -14,7 +14,7 @@
import json
import os
import tempfile
from typing import List, Optional, cast
from typing import List, cast
from unittest.mock import Mock
import yaml
@ -149,15 +149,12 @@ class ApplicationServiceTransactionStoreTestCase(unittest.HomeserverTestCase):
outfile.write(yaml.dump(as_yaml))
self.as_yaml_files.append(as_token)
def _set_state(
self, id: str, state: ApplicationServiceState, txn: Optional[int] = None
):
def _set_state(self, id: str, state: ApplicationServiceState):
return self.db_pool.runOperation(
self.engine.convert_param_style(
"INSERT INTO application_services_state(as_id, state, last_txn) "
"VALUES(?,?,?)"
"INSERT INTO application_services_state(as_id, state) VALUES(?,?)"
),
(id, state.value, txn),
(id, state.value),
)
def _insert_txn(self, as_id, txn_id, events):
@ -280,17 +277,6 @@ class ApplicationServiceTransactionStoreTestCase(unittest.HomeserverTestCase):
self.store.complete_appservice_txn(txn_id=txn_id, service=service)
)
res = self.get_success(
self.db_pool.runQuery(
self.engine.convert_param_style(
"SELECT last_txn FROM application_services_state WHERE as_id=?"
),
(service.id,),
)
)
self.assertEqual(1, len(res))
self.assertEqual(txn_id, res[0][0])
res = self.get_success(
self.db_pool.runQuery(
self.engine.convert_param_style(
@ -316,14 +302,13 @@ class ApplicationServiceTransactionStoreTestCase(unittest.HomeserverTestCase):
res = self.get_success(
self.db_pool.runQuery(
self.engine.convert_param_style(
"SELECT last_txn, state FROM application_services_state WHERE as_id=?"
"SELECT state FROM application_services_state WHERE as_id=?"
),
(service.id,),
)
)
self.assertEqual(1, len(res))
self.assertEqual(txn_id, res[0][0])
self.assertEqual(ApplicationServiceState.UP.value, res[0][1])
self.assertEqual(ApplicationServiceState.UP.value, res[0][0])
res = self.get_success(
self.db_pool.runQuery(