fix(db): add additional connection pool for projection spooling (#7094)

* fix(db): add additional connection pool for projection spooling

* use correct connection pool for projections

---------

Co-authored-by: Livio Spring <[email protected]>
This commit is contained in:
Tim Möhlmann
2023-12-20 16:13:04 +00:00
committed by GitHub
co-authored by Livio Spring
parent f4e73b9b75
commit fe1337536f
16 changed files with 475 additions and 116 deletions
+6 -15
View File
@@ -17,9 +17,10 @@ import (
)
type Config struct {
Dialects map[string]interface{} `mapstructure:",remain"`
EventPushConnRatio float32
connector dialect.Connector
Dialects map[string]interface{} `mapstructure:",remain"`
EventPushConnRatio float64
ProjectionSpoolerConnRatio float64
connector dialect.Connector
}
func (c *Config) SetConnector(connector dialect.Connector) {
@@ -109,18 +110,8 @@ func QueryJSONObject[T any](ctx context.Context, db *DB, query string, args ...a
return obj, nil
}
const (
zitadelAppName = "zitadel"
EventstorePusherAppName = "zitadel_es_pusher"
)
func Connect(config Config, useAdmin, isEventPusher bool) (*DB, error) {
appName := zitadelAppName
if isEventPusher {
appName = EventstorePusherAppName
}
client, err := config.connector.Connect(useAdmin, isEventPusher, config.EventPushConnRatio, appName)
func Connect(config Config, useAdmin bool, purpose dialect.DBPurpose) (*DB, error) {
client, err := config.connector.Connect(useAdmin, config.EventPushConnRatio, config.ProjectionSpoolerConnRatio, purpose)
if err != nil {
return nil, err
}