fix: never_cache sync wrapper broke async dispatch - add async_never_cache_dispatch (wallet/login_record/tasks)
This commit is contained in:
@@ -6,6 +6,7 @@ from django.utils.decorators import method_decorator
|
||||
from django.views.decorators.cache import never_cache
|
||||
from datetime import timedelta
|
||||
|
||||
from utils.async_decorators import async_never_cache_dispatch
|
||||
from utils.response_codes import (
|
||||
ResponseCode,
|
||||
create_standardized_response,
|
||||
@@ -18,7 +19,7 @@ from drf_yasg import openapi
|
||||
from chunyu_project.common_schemas import success_response, error_response, unauthorized_response, not_found_response
|
||||
|
||||
|
||||
@method_decorator(never_cache, name='dispatch')
|
||||
@async_never_cache_dispatch
|
||||
class LoginRecordListAPIView(APIView):
|
||||
permission_classes = [IsAuthenticated]
|
||||
|
||||
@@ -87,7 +88,7 @@ class LoginRecordListAPIView(APIView):
|
||||
)
|
||||
|
||||
|
||||
@method_decorator(never_cache, name='dispatch')
|
||||
@async_never_cache_dispatch
|
||||
class LoginRecordDeleteAPIView(APIView):
|
||||
permission_classes = [IsAuthenticated]
|
||||
|
||||
@@ -117,7 +118,7 @@ class LoginRecordDeleteAPIView(APIView):
|
||||
)
|
||||
|
||||
|
||||
@method_decorator(never_cache, name='dispatch')
|
||||
@async_never_cache_dispatch
|
||||
class LoginRecordClearAPIView(APIView):
|
||||
permission_classes = [IsAuthenticated]
|
||||
|
||||
|
||||
+5
-4
@@ -10,6 +10,7 @@ from django.views.decorators.cache import never_cache
|
||||
from datetime import timedelta
|
||||
import logging
|
||||
|
||||
from utils.async_decorators import async_never_cache_dispatch
|
||||
from utils.response_codes import (
|
||||
ResponseCode,
|
||||
create_standardized_response,
|
||||
@@ -112,7 +113,7 @@ def check_level_up(user_level):
|
||||
return leveled_up
|
||||
|
||||
|
||||
@method_decorator(never_cache, name='dispatch')
|
||||
@async_never_cache_dispatch
|
||||
class TaskListAPIView(APIView):
|
||||
permission_classes = [IsAuthenticated]
|
||||
|
||||
@@ -195,7 +196,7 @@ class TaskListAPIView(APIView):
|
||||
)
|
||||
|
||||
|
||||
@method_decorator(never_cache, name='dispatch')
|
||||
@async_never_cache_dispatch
|
||||
class TaskTrackAPIView(APIView):
|
||||
permission_classes = [IsAuthenticated]
|
||||
|
||||
@@ -249,7 +250,7 @@ class TaskTrackAPIView(APIView):
|
||||
)
|
||||
|
||||
|
||||
@method_decorator(never_cache, name='dispatch')
|
||||
@async_never_cache_dispatch
|
||||
class TaskClaimAPIView(APIView):
|
||||
permission_classes = [IsAuthenticated]
|
||||
|
||||
@@ -377,7 +378,7 @@ class TaskClaimAPIView(APIView):
|
||||
)
|
||||
|
||||
|
||||
@method_decorator(never_cache, name='dispatch')
|
||||
@async_never_cache_dispatch
|
||||
class UserLevelAPIView(APIView):
|
||||
permission_classes = [IsAuthenticated]
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ import logging
|
||||
|
||||
from asgiref.sync import sync_to_async
|
||||
|
||||
from utils.async_decorators import async_never_cache_dispatch
|
||||
from utils.response_codes import (
|
||||
ResponseCode,
|
||||
create_standardized_response,
|
||||
@@ -25,7 +26,7 @@ from chunyu_project.common_schemas import success_response, error_response, unau
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@method_decorator(never_cache, name='dispatch')
|
||||
@async_never_cache_dispatch
|
||||
class WalletBalanceAPIView(APIView):
|
||||
permission_classes = [IsAuthenticated]
|
||||
|
||||
@@ -222,7 +223,7 @@ async def track_checkin_task(user):
|
||||
logger.error(f'签到任务进度更新失败: {e}')
|
||||
|
||||
|
||||
@method_decorator(never_cache, name='dispatch')
|
||||
@async_never_cache_dispatch
|
||||
class CheckinStatusAPIView(APIView):
|
||||
permission_classes = [IsAuthenticated]
|
||||
|
||||
@@ -277,7 +278,7 @@ class CheckinStatusAPIView(APIView):
|
||||
)
|
||||
|
||||
|
||||
@method_decorator(never_cache, name='dispatch')
|
||||
@async_never_cache_dispatch
|
||||
class CheckinAPIView(APIView):
|
||||
permission_classes = [IsAuthenticated]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user