From c605e587a6ee17029b8f072351de8b81a473dce5 Mon Sep 17 00:00:00 2001 From: Trygve Aaberge Date: Thu, 4 Apr 2019 14:01:43 +0200 Subject: Inform about retry limit in failed connection message If wee-slack has tried to connect too many times, it will give up. Inform about this in the error message, instead of keep saying that it will try to reconnect. --- wee_slack.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'wee_slack.py') diff --git a/wee_slack.py b/wee_slack.py index 75fe695..c1e683b 100644 --- a/wee_slack.py +++ b/wee_slack.py @@ -453,9 +453,11 @@ class EventRouter(object): self.reply_buffer.pop(request_metadata.response_id, None) self.delete_context(data) if request_metadata.request == 'rtm.start': - w.prnt('', ('Failed connecting to slack team with token starting with {}, ' + - 'retrying. If this persists, try increasing slack_timeout.') - .format(request_metadata.token[:15])) + retry_text = ('retrying' if request_metadata.should_try() else + 'will not retry after too many failed attempts') + w.prnt('', ('Failed connecting to slack team with token starting with {}, {}. ' + + 'If this persists, try increasing slack_timeout.') + .format(request_metadata.token[:15], retry_text)) dbg('rtm.start failed with return_code {}. stack:\n{}' .format(return_code, ''.join(traceback.format_stack())), level=5) self.receive(request_metadata) -- cgit