mirror of
https://github.com/element-hq/dendrite.git
synced 2025-09-13 21:02:25 +03:00
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
This commit is contained in:
parent
979a551f1e
commit
4ad5f9c982
71 changed files with 345 additions and 240 deletions
|
@ -42,12 +42,25 @@ func AddInternalRoutes(router *mux.Router, intAPI api.UserInternalAPI) {
|
|||
// NewInternalAPI returns a concerete implementation of the internal API. Callers
|
||||
// can call functions directly on the returned API or via an HTTP interface using AddInternalRoutes.
|
||||
func NewInternalAPI(
|
||||
base *base.BaseDendrite, db storage.Database, cfg *config.UserAPI,
|
||||
base *base.BaseDendrite, cfg *config.UserAPI,
|
||||
appServices []config.ApplicationService, keyAPI keyapi.KeyInternalAPI,
|
||||
rsAPI rsapi.RoomserverInternalAPI, pgClient pushgateway.Client,
|
||||
) api.UserInternalAPI {
|
||||
js, _ := jetstream.Prepare(base.ProcessContext, &cfg.Matrix.JetStream)
|
||||
|
||||
db, err := storage.NewUserAPIDatabase(
|
||||
base,
|
||||
&cfg.AccountDatabase,
|
||||
cfg.Matrix.ServerName,
|
||||
cfg.BCryptCost,
|
||||
cfg.OpenIDTokenLifetimeMS,
|
||||
api.DefaultLoginTokenLifetime,
|
||||
cfg.Matrix.ServerNotices.LocalPart,
|
||||
)
|
||||
if err != nil {
|
||||
logrus.WithError(err).Panicf("failed to connect to accounts db")
|
||||
}
|
||||
|
||||
syncProducer := producers.NewSyncAPI(
|
||||
db, js,
|
||||
// TODO: user API should handle syncs for account data. Right now,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue