feat: 100% async - native async serializers (adata/asave/acreate), async cache (redis.asyncio), view call-site migration
This commit is contained in:
+3
-3
@@ -102,7 +102,7 @@ class SendChangeEmailCodeAPIView(APIView):
|
||||
|
||||
try:
|
||||
# save() 内部触发验证码邮件发送(Celery/cache/SMTP 链路),线程池兜底
|
||||
email = await sync_to_async(serializer.save)()
|
||||
email = await serializer.asave()
|
||||
await sync_to_async(reset_failures)(operation, identifier)
|
||||
return create_standardized_response(
|
||||
data={'email_sent': True},
|
||||
@@ -157,11 +157,11 @@ class ChangeEmailAPIView(APIView):
|
||||
)
|
||||
|
||||
try:
|
||||
updated_user = await sync_to_async(serializer.save)()
|
||||
updated_user = await serializer.asave()
|
||||
user_serializer = UserSerializer(updated_user)
|
||||
|
||||
return create_standardized_response(
|
||||
data={'user': user_serializer.data},
|
||||
data={'user': await user_serializer.adata},
|
||||
code=ResponseCode.EMAIL_CHANGED,
|
||||
status_code=status.HTTP_200_OK
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user