| | |
| | | var result []byte |
| | | if request.CompareType == facecompare.CompareType_Compare { |
| | | var compareArgInfo protomsg.CompareArgs |
| | | var cacheChangeInfo protomsg.EsPersonCacheChange |
| | | if err = proto.Unmarshal(request.Payload, &compareArgInfo); err == nil { |
| | | timeStart := time.Now() |
| | | result = compare.GetComparePersonBaseInfo(compareArgInfo) |
| | | logger.Debug("用时:", time.Since(timeStart)) |
| | | } else if err = proto.Unmarshal(request.Payload, &cacheChangeInfo); err == nil { |
| | | cache.UpdateCache(&cacheChangeInfo) |
| | | } else { |
| | | logger.Warn("CompareArgs or EsPersonCacheChange json unmarshal error") |
| | | continue |
| | |
| | | id := string(compareEvent.Payload) |
| | | cache.UpdateDbPersonsCacheById(id) |
| | | logger.Info("--------------更新人员缓存, id: ", id) |
| | | } else if compareEvent.EventType == protomsg.CompareEventType_DeleteCache { //库中新增更新缓存 |
| | | id := string(compareEvent.Payload) |
| | | cache.DeleteDbPersonsCacheById(id) |
| | | logger.Info("--------------删除人员缓存, id: ", id) |
| | | } |
| | | } else { |
| | | logger.Warn("CompareEvent json unmarshal error") |