Hi there,
after introducing maxOpenConnections in DB conns I encountered the below issue with OSS build. OSS version of the function has not been updated.
#11 42.58 cmd/drone-server/inject_store.go:63:19: too many arguments in call to db.Connect
#11 42.58 have (string, string, int)
#11 42.58 want (string, string)
Proposed fix as per contributing.md guidelines. Imho it does not harm to have it consistent even if it’s sqlite (sql - The Go Programming Language).
index e401bd66..51df642a 100644
--- a/store/shared/db/conn_oss.go
+++ b/store/shared/db/conn_oss.go
@@ -26,7 +26,7 @@ import (
)
// Connect to an embedded sqlite database.
-func Connect(driver, datasource string) (*DB, error) {
+func Connect(driver, datasource string, maxOpenConnections int) (*DB, error) {
db, err := sql.Open(driver, datasource)
if err != nil {
return nil, err
@@ -34,6 +34,10 @@ func Connect(driver, datasource string) (*DB, error) {
if err := sqlite.Migrate(db); err != nil {
return nil, err
}
+
+ // generally set to 0, user configured for larger installs
+ db.SetMaxOpenConns(maxOpenConnections)
+
return &DB{
conn: sqlx.NewDb(db, driver),
lock: &sync.RWMutex{},
Cheers,
Pawel S