From 0e67a3f70372c6520deaf7a848ed8cb60f2d0608 Mon Sep 17 00:00:00 2001 From: Patrick Cloke Date: Fri, 14 Apr 2023 14:06:45 -0400 Subject: Stop passing in the base-store. --- synapse/storage/_base.py | 4 ---- synapse/storage/databases/main/__init__.py | 2 +- synapse/storage/databases/main/relations.py | 4 +--- 3 files changed, 2 insertions(+), 8 deletions(-) diff --git a/synapse/storage/_base.py b/synapse/storage/_base.py index a30ebda0c8..481fec72fe 100644 --- a/synapse/storage/_base.py +++ b/synapse/storage/_base.py @@ -25,7 +25,6 @@ from synapse.util.caches.descriptors import CachedFunction if TYPE_CHECKING: from synapse.server import HomeServer - from synapse.storage.databases import DataStore logger = logging.getLogger(__name__) @@ -45,14 +44,11 @@ class SQLBaseStore(metaclass=ABCMeta): database: DatabasePool, db_conn: LoggingDatabaseConnection, hs: "HomeServer", - datastore: Optional["DataStore"] = None, ): self.hs = hs self._clock = hs.get_clock() self.database_engine = database.engine self.db_pool = database - # A reference back to the root datastore. - self.datastore = datastore self.external_cached_functions: Dict[str, CachedFunction] = {} diff --git a/synapse/storage/databases/main/__init__.py b/synapse/storage/databases/main/__init__.py index 80e49dfa8b..ddbc183b4b 100644 --- a/synapse/storage/databases/main/__init__.py +++ b/synapse/storage/databases/main/__init__.py @@ -141,7 +141,7 @@ class DataStore( super().__init__(database, db_conn, hs) # This is a bit repetitive, but avoids dynamically setting attributes. - self.relations: RelationsStore = RelationsStore(database, db_conn, hs, self) + self.relations = RelationsStore(database, db_conn, hs) async def get_users(self) -> List[JsonDict]: """Function to retrieve a list of users in users table. diff --git a/synapse/storage/databases/main/relations.py b/synapse/storage/databases/main/relations.py index 2a6af4f8ce..4a6c6c724d 100644 --- a/synapse/storage/databases/main/relations.py +++ b/synapse/storage/databases/main/relations.py @@ -52,7 +52,6 @@ from synapse.util.caches.descriptors import cached, cachedList if TYPE_CHECKING: from synapse.server import HomeServer - from synapse.storage.databases.main import DataStore logger = logging.getLogger(__name__) @@ -96,9 +95,8 @@ class RelationsWorkerStore(SQLBaseStore): database: DatabasePool, db_conn: LoggingDatabaseConnection, hs: "HomeServer", - datastore: "DataStore", ): - super().__init__(database, db_conn, hs, datastore) + super().__init__(database, db_conn, hs) self.db_pool.updates.register_background_update_handler( "threads_backfill", self._backfill_threads -- cgit 1.4.1