Fix: improve recover_pending_tasks timeout (#7408)

### What problem does this PR solve?

Fix the redis lock will always timeout (change the logic order release
lock first)

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
Stephen Hu 2025-04-29 16:50:39 +08:00 committed by GitHub
parent 552475dd5c
commit c88e4b3fc0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -700,12 +700,13 @@ def recover_pending_tasks():
f"time since delivered: {msg['time_since_delivered'] / 1000} s"
)
REDIS_CONN.requeue_msg(queue_name, SVR_CONSUMER_GROUP_NAME, msg['message_id'])
stop_event.wait(60)
except Exception:
logging.warning("recover_pending_tasks got exception")
finally:
redis_lock.release()
stop_event.wait(60)
async def main():