Skip to content

Commit

Permalink
add max try in wait for reply method
Browse files Browse the repository at this point in the history
  • Loading branch information
noahzark committed May 9, 2018
1 parent b430f69 commit 576994d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion model/chat_robot.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 576994d

Please sign in to comment.