From 9577af32219009d2b755f9a4193d0c5581c3dafc Mon Sep 17 00:00:00 2001 From: Aaron3S Date: Wed, 18 Dec 2024 18:07:59 +0800 Subject: [PATCH] feat: refresh facelive cache --- apps/authentication/api/face.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/apps/authentication/api/face.py b/apps/authentication/api/face.py index 02e82fabd..e6e7ee1b1 100644 --- a/apps/authentication/api/face.py +++ b/apps/authentication/api/face.py @@ -228,16 +228,20 @@ class FaceMonitorCallbackApi(CreateAPIView): face_codes = serializer.validated_data.get('face_codes') if not user: + context.save() return Response(data={'msg': 'user {} not found' .format(context.user_id)}, status=400) - if not self._check_face_codes(face_codes, user): + if not face_codes or not self._check_face_codes(face_codes, user): + context.save() return Response(data={'msg': 'face codes not matched'}, status=400) if action == FaceMonitorActionChoices.Pause: context.pause_sessions() if action == FaceMonitorActionChoices.Resume: context.resume_sessions() + + context.save() return Response(status=200) @staticmethod