diff --git a/json_utility.go b/json_utility.go index b5a3aa9..5ce4f01 100644 --- a/json_utility.go +++ b/json_utility.go @@ -7,8 +7,10 @@ import ( "gopkg.in/rana/ora.v3" "io" "io/ioutil" + "sync" ) +var mu = &sync.Mutex{} var allPayloads []payloadBuff type LangMap map[string]map[string]string @@ -134,6 +136,8 @@ func loadCorrelations(id string) []CorrelationField { func InitTables(db *ora.Ses, project string) error { jsonbuf, _ := fetchJSON(db, EqualQuotes(project)) + mu.Lock() + defer mu.Unlock() json.Unmarshal(jsonbuf, &allPayloads) if len(allPayloads) == 0 { return errors.New("tables config is corrupt")