Fix data race

This commit is contained in:
tidwall 2018-08-02 17:30:53 -07:00
parent f31cead207
commit 632b0ebf63
1 changed files with 2 additions and 0 deletions
pkg/controller

View File

@ -327,6 +327,8 @@ func fenceMatchObject(fence *liveFenceSwitches, obj geojson.Object) bool {
} }
func fenceMatchRoam(c *Controller, fence *liveFenceSwitches, tkey, tid string, obj geojson.Object) (keys, ids []string, meterss []float64) { func fenceMatchRoam(c *Controller, fence *liveFenceSwitches, tkey, tid string, obj geojson.Object) (keys, ids []string, meterss []float64) {
c.mu.RLock()
defer c.mu.RUnlock()
col := c.getCol(fence.roam.key) col := c.getCol(fence.roam.key)
if col == nil { if col == nil {
return return