mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-08-01 13:26:07 -04:00
Factor out get_db_conn to HomeServer base class
This function is identical to all subclasses, so we may as well push it up to the base class to reduce duplication (and make use of it in the tests)
This commit is contained in:
parent
2b91846497
commit
25adde9a04
11 changed files with 17 additions and 130 deletions
|
@ -118,19 +118,6 @@ class FrontendProxySlavedStore(
|
|||
|
||||
|
||||
class FrontendProxyServer(HomeServer):
|
||||
def get_db_conn(self, run_new_connection=True):
|
||||
# Any param beginning with cp_ is a parameter for adbapi, and should
|
||||
# not be passed to the database engine.
|
||||
db_params = {
|
||||
k: v for k, v in self.db_config.get("args", {}).items()
|
||||
if not k.startswith("cp_")
|
||||
}
|
||||
db_conn = self.database_engine.module.connect(**db_params)
|
||||
|
||||
if run_new_connection:
|
||||
self.database_engine.on_new_connection(db_conn)
|
||||
return db_conn
|
||||
|
||||
def setup(self):
|
||||
logger.info("Setting up.")
|
||||
self.datastore = FrontendProxySlavedStore(self.get_db_conn(), self)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue