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:
parent
32349481ef
commit
a0ab619aeb
1 changed files with 5 additions and 2 deletions
|
|
@ -59,11 +59,14 @@ def update_progress():
|
||||||
if redis_lock.acquire():
|
if redis_lock.acquire():
|
||||||
DocumentService.update_progress()
|
DocumentService.update_progress()
|
||||||
redis_lock.release()
|
redis_lock.release()
|
||||||
stop_event.wait(6)
|
|
||||||
except Exception:
|
except Exception:
|
||||||
logging.exception("update_progress exception")
|
logging.exception("update_progress exception")
|
||||||
finally:
|
finally:
|
||||||
redis_lock.release()
|
try:
|
||||||
|
redis_lock.release()
|
||||||
|
except Exception:
|
||||||
|
logging.exception("update_progress exception")
|
||||||
|
stop_event.wait(6)
|
||||||
|
|
||||||
def signal_handler(sig, frame):
|
def signal_handler(sig, frame):
|
||||||
logging.info("Received interrupt signal, shutting down...")
|
logging.info("Received interrupt signal, shutting down...")
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue