diff options
author | Neil Alexander <neilalexander@users.noreply.github.com> | 2022-05-03 16:35:06 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-03 16:35:06 +0100 |
commit | 4ad5f9c982fe5dc9e306a9269621ead8c31248cf (patch) | |
tree | 9eac975c1d7232b35ce4d0c7f658db3c2289f0ab /roomserver/storage/storage.go | |
parent | 979a551f1e2aeb9f3417df5e52a7279230b7a3ba (diff) |
Global database connection pool (for monolith mode) (#2411)
* Allow monolith components to share a single database pool
* Don't yell about missing connection strings
* Rename field
* Setup tweaks
* Fix panic
* Improve configuration checks
* Update config
* Fix lint errors
* Update comments
Diffstat (limited to 'roomserver/storage/storage.go')
-rw-r--r-- | roomserver/storage/storage.go | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/roomserver/storage/storage.go b/roomserver/storage/storage.go index 9f98ea3e..8a87b7d7 100644 --- a/roomserver/storage/storage.go +++ b/roomserver/storage/storage.go @@ -23,16 +23,17 @@ import ( "github.com/matrix-org/dendrite/internal/caching" "github.com/matrix-org/dendrite/roomserver/storage/postgres" "github.com/matrix-org/dendrite/roomserver/storage/sqlite3" + "github.com/matrix-org/dendrite/setup/base" "github.com/matrix-org/dendrite/setup/config" ) // Open opens a database connection. -func Open(dbProperties *config.DatabaseOptions, cache caching.RoomServerCaches) (Database, error) { +func Open(base *base.BaseDendrite, dbProperties *config.DatabaseOptions, cache caching.RoomServerCaches) (Database, error) { switch { case dbProperties.ConnectionString.IsSQLite(): - return sqlite3.Open(dbProperties, cache) + return sqlite3.Open(base, dbProperties, cache) case dbProperties.ConnectionString.IsPostgres(): - return postgres.Open(dbProperties, cache) + return postgres.Open(base, dbProperties, cache) default: return nil, fmt.Errorf("unexpected database type") } |