sqldb+lncfg: use SQLite-appropriate default for max connections
Both the sqldb and kvdb SQLite layers were not using a sensible default for MaxConnections. The sqldb store used defaultMaxConns (25) which is meant for Postgres, and the kvdb path passed 0 (unlimited) to sqlbase.Init when unconfigured. Add a MaxConns() method on SqliteConfig that returns the configured value or defaults to 2, appropriate for SQLite's single-writer model. Use it in both sqldb/sqlite.go and lncfg/db.go so both layers share the same default.
This commit is contained in:
3 files changed
+21
-3
No files matched your search
+1
-1
@@ -207,7 +207,7 @@ func (db *DB) Init(ctx context.Context, dbPath string) error {
|
||||
sqlbase.Init(db.Postgres.MaxConnections)
|
||||
|
||||
case db.Backend == SqliteBackend:
|
||||
sqlbase.Init(db.Sqlite.MaxConnections)
|
||||
sqlbase.Init(db.Sqlite.MaxConns())
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
Reference in new issue
Block a user