throttle hot read endpoints and cap unbounded list responses
progress/views.py
- GuestAwareReadThrottle (same guest-by-IP pattern as the other apps);
throttle_scope='read' on UserSummaryView, StreakCalendarView,
LeaderboardView.
notifications/views.py
- GuestAwareReadThrottle + throttle_scope='read' on NotificationListView.
- list capped at NOTIFICATIONS_MAX=100 newest (Meta.ordering already
newest-first); unreadCount still counted over the full set.
notifications/tests.py
- 150 rows -> 100 returned newest-first, unreadCount = 75.
rag/views.py
- ChunkListView: explicit order_by('-id') before the existing [:200] cap.
ai_tutor/views.py
- ConversationMessagesView: return the newest 200 messages in
chronological order instead of the whole conversation.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -152,6 +152,6 @@ class ChunkListView(APIView):
|
||||
qs = qs.filter(lesson_id=lesson_id)
|
||||
if subject:
|
||||
qs = qs.filter(subject=subject)
|
||||
rows = list(qs[:200])
|
||||
rows = list(qs.order_by('-id')[:200])
|
||||
data = {'count': len(rows), 'results': ChunkSerializer(rows, many=True).data}
|
||||
return Response(ChunkListResponseSerializer(data).data)
|
||||
|
||||
Reference in New Issue
Block a user