Skip to content

Commit a7e7c11

Browse files
committed
fix race problem
1 parent 4cb2e42 commit a7e7c11

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

internal/config/config.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"path"
77
"strconv"
88
"strings"
9+
"sync"
910

1011
"github.com/dagu-dev/dagu/internal/utils"
1112
"github.com/spf13/viper"
@@ -51,7 +52,14 @@ func Get() *Config {
5152
return instance
5253
}
5354

55+
var (
56+
mu sync.Mutex
57+
)
58+
5459
func LoadConfig(userHomeDir string) error {
60+
mu.Lock()
61+
defer mu.Unlock()
62+
5563
appHome := appHomeDir(userHomeDir)
5664

5765
viper.SetEnvPrefix("dagu")

0 commit comments

Comments
 (0)