diff --git a/ucs-school-umc-exam/umc/python/schoolexam/__init__.py b/ucs-school-umc-exam/umc/python/schoolexam/__init__.py index cc45384f..7a0fdb8d 100644 --- a/ucs-school-umc-exam/umc/python/schoolexam/__init__.py +++ b/ucs-school-umc-exam/umc/python/schoolexam/__init__.py @@ -68,6 +68,7 @@ class Instance(SchoolBaseModule): SchoolBaseModule.__init__(self) self._tmpDir = None self._progress_state = util.Progress() + self._last_progress_state = None self._lessons = SchoolLessons() def init(self): @@ -148,7 +149,16 @@ class Instance(SchoolBaseModule): @simple_response def progress(self): - return self._progress_state.poll() + progress_state = self._progress_state.poll() + timeout = 5 + seconds_elapsed = 0 + while progress_state == self._last_progress_state or timeout > seconds_elapsed: + progress_state = self._progress_state.poll() + time.sleep(1) + seconds_elapsed += 1 + if progress_state['finished']: + self._progress_state.reset() + return progress_state @sanitize( name=StringSanitizer(required=True),