aboutsummaryrefslogtreecommitdiffstats
path: root/wee_slack.py
diff options
context:
space:
mode:
authorTrygve Aaberge <trygveaa@gmail.com>2019-04-04 14:01:43 +0200
committerTrygve Aaberge <trygveaa@gmail.com>2019-04-04 14:01:43 +0200
commitc605e587a6ee17029b8f072351de8b81a473dce5 (patch)
treebbccc6d6133e7faa8cb3f986ea6f549dd8dfd437 /wee_slack.py
parentea3ec06598d9fc4dff30f7eb7ffc082ef0d42c49 (diff)
downloadwee-slack-c605e587a6ee17029b8f072351de8b81a473dce5.tar.gz
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.
Diffstat (limited to 'wee_slack.py')
-rw-r--r--wee_slack.py8
1 files changed, 5 insertions, 3 deletions
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)