fix: 人脸库重载移到syncResourceToDevice内部,与文件传输绑定

This commit is contained in:
tian 2026-07-25 12:53:59 +08:00
parent 77f17791ed
commit 1096218c1f

View File

@ -426,12 +426,6 @@ func (s *TaskService) executeOnDevice(task *models.Task, did string) {
s.updateDeviceStatus(task.ID, did, models.TaskFailed, 0, err.Error())
return
}
// Auto-reload face gallery after sync
if payload, ok := task.Payload.(map[string]any); ok {
if name, ok := payload["resource_name"].(string); ok && name == "face_gallery" {
s.agent.Do("POST", dev.IP, dev.AgentPort, "/v1/face-gallery/reload", nil)
}
}
s.updateDeviceStatus(task.ID, did, models.TaskSuccess, 1.0, "")
s.appendAuditLog(task, did, models.TaskSuccess, "")
@ -561,6 +555,10 @@ func (s *TaskService) syncResourceToDevice(task *models.Task, dev *models.Device
if code >= 400 {
return fmt.Errorf("agent error: %d %s", code, strings.TrimSpace(string(resp)))
}
// Auto-reload after syncing face_gallery
if item.ResourceType == "face_gallery" {
_, _, _ = s.agent.Do("POST", dev.IP, dev.AgentPort, "/v1/face-gallery/reload", nil)
}
}
return nil
}