zhangzengfei
2024-05-08 8b3fa783355cb3c5be9dc9ed3cfebaee27dc2a4c
main.go
@@ -92,13 +92,10 @@
         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
@@ -112,7 +109,10 @@
                  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")
               continue