fix orm datarace

This commit is contained in:
luxueyan 2019-06-14 14:43:02 +08:00
parent 1b6edafc96
commit 394a73c75f
1 changed files with 2 additions and 2 deletions

View File

@ -335,11 +335,11 @@ func RegisterModelWithSuffix(suffix string, models ...interface{}) {
// BootStrap bootstrap models.
// make all model parsed and can not add more models
func BootStrap() {
modelCache.Lock()
defer modelCache.Unlock()
if modelCache.done {
return
}
modelCache.Lock()
defer modelCache.Unlock()
bootStrap()
modelCache.done = true
}