fix: renamed DatabaseNotReadyError (#35390)

This commit is contained in:
Muhammad Anas
2024-08-29 18:47:54 +05:00
committed by GitHub
parent 1a431b6a26
commit 5323c55abc
2 changed files with 6 additions and 6 deletions

View File

@@ -3,9 +3,9 @@ Custom exceptions raised by grades.
"""
class DatabaseNotReadyError(IOError):
class ScoreNotFoundError(IOError):
"""
Subclass of IOError to indicate the database has not yet committed
the data we're trying to find.
Subclass of IOError to indicate the staff has not yet graded the problem or
the database has not yet committed the data we're trying to find.
"""
pass # lint-amnesty, pylint: disable=unnecessary-pass

View File

@@ -33,7 +33,7 @@ from xmodule.modulestore.django import modulestore # lint-amnesty, pylint: disa
from .config.waffle import DISABLE_REGRADE_ON_POLICY_CHANGE
from .constants import ScoreDatabaseTableEnum
from .course_grade_factory import CourseGradeFactory
from .exceptions import DatabaseNotReadyError
from .exceptions import ScoreNotFoundError
from .grade_utils import are_grades_frozen
from .signals.signals import SUBSECTION_SCORE_CHANGED
from .subsection_grade_factory import SubsectionGradeFactory
@@ -45,7 +45,7 @@ COURSE_GRADE_TIMEOUT_SECONDS = 1200
KNOWN_RETRY_ERRORS = ( # Errors we expect occasionally, should be resolved on retry
DatabaseError,
ValidationError,
DatabaseNotReadyError,
ScoreNotFoundError,
UsageKeyNotInBlockStructure,
)
RECALCULATE_GRADE_DELAY_SECONDS = 2 # to prevent excessive _has_db_updated failures. See TNL-6424.
@@ -239,7 +239,7 @@ def _recalculate_subsection_grade(self, **kwargs):
has_database_updated = _has_db_updated_with_new_score(self, scored_block_usage_key, **kwargs)
if not has_database_updated:
raise DatabaseNotReadyError
raise ScoreNotFoundError
_update_subsection_grades(
course_key,