Fix: ensure update_progress loop always waits between iterations (#9528)

Move stop_event.wait(6) into finally block so that even when an
exception occurs, the loop still sleeps before retrying. This prevents
busy looping and excessive error logs when Redis connection fails.

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
Cheng Zhikai
2025-08-19 09:42:15 +08:00
committed by GitHub
parent 32349481ef
commit a0ab619aeb

View File

@ -59,11 +59,14 @@ def update_progress():
if redis_lock.acquire():
DocumentService.update_progress()
redis_lock.release()
stop_event.wait(6)
except Exception:
logging.exception("update_progress exception")
finally:
try:
redis_lock.release()
except Exception:
logging.exception("update_progress exception")
stop_event.wait(6)
def signal_handler(sig, frame):
logging.info("Received interrupt signal, shutting down...")