mirror of
https://github.com/astaxie/beego.git
synced 2024-11-14 17:20:56 +00:00
Merge pull request #3685 from Anderson-Lu/fix_orm_datarace
fix orm datarace
This commit is contained in:
commit
c265d32c36
@ -335,11 +335,11 @@ func RegisterModelWithSuffix(suffix string, models ...interface{}) {
|
|||||||
// BootStrap bootstrap models.
|
// BootStrap bootstrap models.
|
||||||
// make all model parsed and can not add more models
|
// make all model parsed and can not add more models
|
||||||
func BootStrap() {
|
func BootStrap() {
|
||||||
|
modelCache.Lock()
|
||||||
|
defer modelCache.Unlock()
|
||||||
if modelCache.done {
|
if modelCache.done {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
modelCache.Lock()
|
|
||||||
defer modelCache.Unlock()
|
|
||||||
bootStrap()
|
bootStrap()
|
||||||
modelCache.done = true
|
modelCache.done = true
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user