🎧 Your Personal Streaming Service
Go airsonicmadsonicmedia-servermusicmusic-servernavidromeopensubsonicraspberry-piself-hostedstreamerstreaming-apistreaming-audiosubsonicsubsonic-server
Replace panics with log.Fatals
Deluanf88d3f82dac1
diff --git a/db/db.go b/db/db.goindex eb17bca74..af52ca752 100644--- a/db/db.go+++ b/db/db.go@@ -68,17 +68,20 @@ func Db() DB {}log.Debug("Opening DataBase", "dbPath", Path, "driver", Driver)+ // Create a read database connectionrdb, err := sql.Open(Driver+"_custom", Path)if err != nil {- panic(err)+ log.Fatal("Error opening read database", err)}rdb.SetMaxOpenConns(max(4, runtime.NumCPU()))+ // Create a write database connectionwdb, err := sql.Open(Driver+"_custom", Path)if err != nil {- panic(err)+ log.Fatal("Error opening write database", err)}wdb.SetMaxOpenConns(1)+return &db{readDB: rdb,writeDB: wdb,diff --git a/db/migrations/migration.go b/db/migrations/migration.goindex 8e648f1fd..0c55ecc13 100644--- a/db/migrations/migration.go+++ b/db/migrations/migration.go@@ -29,18 +29,12 @@ update media_file set updated_at = '0001-01-01';return err}-var (- once sync.Once- initialized bool-)-func isDBInitialized(tx *sql.Tx) bool {- once.Do(func() {+ return sync.OnceValue(func() bool {rows, err := tx.Query("select count(*) from property where id=?", consts.InitialSetupFlagKey)checkErr(err)- initialized = checkCount(rows) > 0- })- return initialized+ return checkCount(rows) > 0+ })()}func checkCount(rows *sql.Rows) (count int) {