mirror of
https://github.com/hoernschen/dendrite.git
synced 2025-07-31 21:32:46 +00:00
Merge branch 'master' of https://github.com/matrix-org/dendrite into add-nats-support
This commit is contained in:
commit
a833f5764a
48 changed files with 700 additions and 298 deletions
|
@ -53,7 +53,6 @@ func InitialPowerLevelsContent(roomCreator string) (c gomatrixserverlib.PowerLev
|
|||
"m.room.history_visibility": 100,
|
||||
"m.room.canonical_alias": 50,
|
||||
"m.room.avatar": 50,
|
||||
"m.room.aliases": 0, // anyone can publish aliases by default. Has to be 0 else state_default is used.
|
||||
}
|
||||
c.Users = map[string]int64{roomCreator: 100}
|
||||
return c
|
||||
|
|
|
@ -19,7 +19,6 @@ import (
|
|||
"database/sql"
|
||||
"errors"
|
||||
"fmt"
|
||||
"runtime"
|
||||
"strings"
|
||||
|
||||
"github.com/matrix-org/util"
|
||||
|
@ -113,13 +112,6 @@ func QueryVariadicOffset(count, offset int) string {
|
|||
return str
|
||||
}
|
||||
|
||||
func SQLiteDriverName() string {
|
||||
if runtime.GOOS == "js" {
|
||||
return "sqlite3_js"
|
||||
}
|
||||
return "sqlite3"
|
||||
}
|
||||
|
||||
func minOfInts(a, b int) int {
|
||||
if a <= b {
|
||||
return a
|
||||
|
|
|
@ -104,7 +104,7 @@ func Open(dbProperties *config.DatabaseOptions) (*sql.DB, error) {
|
|||
var driverName, dsn string
|
||||
switch {
|
||||
case dbProperties.ConnectionString.IsSQLite():
|
||||
driverName = SQLiteDriverName()
|
||||
driverName = "sqlite3"
|
||||
dsn, err = ParseFileURI(dbProperties.ConnectionString)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("ParseFileURI: %w", err)
|
||||
|
@ -123,11 +123,11 @@ func Open(dbProperties *config.DatabaseOptions) (*sql.DB, error) {
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if driverName != SQLiteDriverName() {
|
||||
if driverName != "sqlite3" {
|
||||
logrus.WithFields(logrus.Fields{
|
||||
"MaxOpenConns": dbProperties.MaxOpenConns,
|
||||
"MaxIdleConns": dbProperties.MaxIdleConns,
|
||||
"ConnMaxLifetime": dbProperties.ConnMaxLifetime,
|
||||
"MaxOpenConns": dbProperties.MaxOpenConns(),
|
||||
"MaxIdleConns": dbProperties.MaxIdleConns(),
|
||||
"ConnMaxLifetime": dbProperties.ConnMaxLifetime(),
|
||||
"dataSourceName": regexp.MustCompile(`://[^@]*@`).ReplaceAllLiteralString(dsn, "://"),
|
||||
}).Debug("Setting DB connection limits")
|
||||
db.SetMaxOpenConns(dbProperties.MaxOpenConns())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue