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:
ziggie committed 2026-02-11 13:15:56 +01:00
1 parent a7d1a30cf2
commit d87d93b114
3 files changed
+21 -3

No files matched your search

+1 -1
View File
@@ -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