From 9f5500a7f4f8a58aa5aed105556080c61873ea52 Mon Sep 17 00:00:00 2001 From: Muhammad Umar Khan <42294172+mumarkhan999@users.noreply.github.com> Date: Thu, 27 Mar 2025 13:30:03 +0500 Subject: [PATCH] chore: use zpickle to compute collected_blocksture size before cacheing (#36452) Co-authored-by: M Umar Khan --- lms/djangoapps/courseware/courses.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lms/djangoapps/courseware/courses.py b/lms/djangoapps/courseware/courses.py index f239c8052e..bcbf30053a 100644 --- a/lms/djangoapps/courseware/courses.py +++ b/lms/djangoapps/courseware/courses.py @@ -59,7 +59,7 @@ from openedx.core.djangoapps.content.course_overviews.models import CourseOvervi from openedx.core.djangoapps.enrollments.api import get_course_enrollment_details from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers from openedx.core.lib.api.view_utils import LazySequence -from openedx.core.lib.cache_utils import request_cached +from openedx.core.lib.cache_utils import request_cached, zpickle from openedx.core.lib.courses import get_course_by_id from openedx.features.course_duration_limits.access import AuditExpiredError from openedx.features.course_experience import RELATIVE_DATES_FLAG @@ -794,7 +794,7 @@ def get_assignments_grades(user, course_id, cache_timeout): collected_block_structure = get_block_structure_manager(course_id).get_collected() total_bytes_in_one_mb = 1024 * 1024 - data_size_in_mbs = round(len(collected_block_structure) / total_bytes_in_one_mb, 2) + data_size_in_mbs = round(len(zpickle(collected_block_structure)) / total_bytes_in_one_mb, 2) if data_size_in_mbs < total_bytes_in_one_mb * 2: cache.set(cache_key, collected_block_structure, cache_timeout) else: