fix: settings map read and write concurrently

This commit is contained in:
Noah Hsu
2022-11-28 16:53:16 +08:00
parent 61a06992c3
commit 76f37373e0
4 changed files with 31 additions and 15 deletions

View File

@ -7,7 +7,7 @@ import (
)
func GetStr(key string, defaultValue ...string) string {
val, ok := db.GetSettingsMap()[key]
val, ok := db.GetSettingsMap().Load(key)
if !ok {
if len(defaultValue) > 0 {
return defaultValue[0]