From 576994d7cd7e2a8b85737e14394442e0724196c1 Mon Sep 17 00:00:00 2001 From: Feliciano Long Date: Tue, 8 May 2018 19:34:46 -0500 Subject: [PATCH] add max try in wait for reply method --- model/chat_robot.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/model/chat_robot.py b/model/chat_robot.py index 75fa1db..68cd735 100644 --- a/model/chat_robot.py +++ b/model/chat_robot.py @@ -147,9 +147,13 @@ def wait_for_reply(self): def wait_for_this_reply(self, content): result = self.wait_for_reply() + retry = 0 + content = to_str(content) - while to_str(result).find(content) == -1: + while to_str(result).find(content) == -1\ + and retry < self.MAX_RETRY_TIMES: result = self.wait_for_reply() + retry += 1 return result