Replace panics with log.Fatals

This commit is contained in:
Deluan
2024-05-21 17:48:46 -04:00
parent 55bff343cd
commit f88d3f82da
2 changed files with 8 additions and 11 deletions
+3 -9
View File
@@ -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) {