diff options
author | Trygve Aaberge <trygveaa@gmail.com> | 2019-01-28 20:25:46 +0100 |
---|---|---|
committer | Trygve Aaberge <trygveaa@gmail.com> | 2019-02-15 00:20:26 +0100 |
commit | 3d6d3e3cc2b25cf3d888786b280561035374581b (patch) | |
tree | 1d0bbd83ecd42c3539eb39a663e9e544f206f195 | |
parent | ce44f1302116019e20547fc53447ef8a7a69bea3 (diff) | |
download | wee-slack-3d6d3e3cc2b25cf3d888786b280561035374581b.tar.gz |
Disconnect when sending to websocket fails
If sending to the websocket fails, it is most likely down and we'll have
to reconnect. By disconnecting, the reconnect timer will ensure we
reconnect.
-rw-r--r-- | wee_slack.py | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/wee_slack.py b/wee_slack.py index a0fcb3c..bea9ea3 100644 --- a/wee_slack.py +++ b/wee_slack.py @@ -369,7 +369,6 @@ class EventRouter(object): def receive_ws_callback(self, team_hash): """ - incomplete (reconnect) This is called by the global method of the same name. It is triggered when we have incoming data on a websocket, which needs to be read. Once it is read, we will ensure @@ -388,7 +387,6 @@ class EventRouter(object): self.record_event(message_json, 'type', 'websocket') self.receive_json(json.dumps(message_json)) except WebSocketConnectionClosedException: - # TODO: handle reconnect here self.teams[team_hash].set_disconnected() return w.WEECHAT_RC_OK except ssl.SSLWantReadError: @@ -1227,7 +1225,7 @@ class SlackTeam(object): except: print "WS ERROR" dbg("Unexpected error: {}\nSent: {}".format(sys.exc_info()[0], data)) - self.set_connected() + self.set_disconnected() def update_member_presence(self, user, presence): user.presence = presence |