aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRyan Huber <rhuber@gmail.com>2017-07-11 14:28:07 -0700
committerGitHub <noreply@github.com>2017-07-11 14:28:07 -0700
commit8343a4e7cf8f40fa7b556644503604e590cbc869 (patch)
tree9bf9668fefa3115bcda611b69a390c472480a2f9
parent7bf0ea6a4eedc0c98152b3b13f1394676a39d4dd (diff)
parente32e861cbf4ed967cfa4fda0208dd42af0902d75 (diff)
downloadwee-slack-8343a4e7cf8f40fa7b556644503604e590cbc869.tar.gz
Merge pull request #384 from cmatheson/fix-349
Stop polling dead websockets.
-rw-r--r--wee_slack.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/wee_slack.py b/wee_slack.py
index 7ba1995..341cb5e 100644
--- a/wee_slack.py
+++ b/wee_slack.py
@@ -1024,7 +1024,7 @@ class SlackTeam(object):
if self.ws_url:
try:
ws = create_connection(self.ws_url, sslopt=sslopt_ca_certs)
- w.hook_fd(ws.sock._sock.fileno(), 1, 0, 0, "receive_ws_callback", self.get_team_hash())
+ self.hook = w.hook_fd(ws.sock._sock.fileno(), 1, 0, 0, "receive_ws_callback", self.get_team_hash())
ws.sock.setblocking(0)
self.ws = ws
# self.attach_websocket(ws)
@@ -1048,6 +1048,7 @@ class SlackTeam(object):
self.connected = True
def set_disconnected(self):
+ w.unhook(self.hook)
self.connected = False
def set_reconnect_url(self, url):