Skip to content

DeepTutor: Lifelong Personalized Tutoring. https://deeptutor.info/.

fix(C1): wrap handler call in try/finally to always save progress

unknown232f41a4462c
diff --git a/deeptutor/capabilities/guided_learning.py b/deeptutor/capabilities/guided_learning.py
index 44cd1ab28..53ede6126 100644
--- a/deeptutor/capabilities/guided_learning.py
+++ b/deeptutor/capabilities/guided_learning.py
@@ -125,8 +125,10 @@ class GuidedLearningCapability(BaseCapability):
await stream.content("学习流程已完成。进入复习阶段。")
return
- await handler(self, progress, context, stream)
- self._service.save(progress)
+ try:
+ await handler(self, progress, context, stream)
+ finally:
+ self._service.save(progress)
# ── §2 Diagnostic ────────────────────────────────────────────────────