From 61903facdf5d56277bf57c7aa83bce7fb35b597a Mon Sep 17 00:00:00 2001 From: Deluan Date: Wed, 22 May 2024 16:20:51 -0400 Subject: [PATCH] Revert isDBInitialized --- db/migrations/migration.go | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/db/migrations/migration.go b/db/migrations/migration.go index 0c55ecc1..8e648f1f 100644 --- a/db/migrations/migration.go +++ b/db/migrations/migration.go @@ -29,12 +29,18 @@ update media_file set updated_at = '0001-01-01'; return err } +var ( + once sync.Once + initialized bool +) + func isDBInitialized(tx *sql.Tx) bool { - return sync.OnceValue(func() bool { + once.Do(func() { rows, err := tx.Query("select count(*) from property where id=?", consts.InitialSetupFlagKey) checkErr(err) - return checkCount(rows) > 0 - })() + initialized = checkCount(rows) > 0 + }) + return initialized } func checkCount(rows *sql.Rows) (count int) {