1
0
mirror of https://github.com/astaxie/beego.git synced 2024-12-22 18:50:50 +00:00

Merge pull request #3685 from Anderson-Lu/fix_orm_datarace

fix orm datarace
This commit is contained in:
astaxie 2019-06-18 12:05:54 +08:00 committed by GitHub
commit c265d32c36
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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
}