Rename threading internal variable conflict.

This commit is contained in:
Rapptz 2016-05-13 20:24:45 -04:00
parent 9077b4e319
commit e66b2dce88

View File

@ -59,10 +59,10 @@ class KeepAliveHandler(threading.Thread):
self.interval = interval self.interval = interval
self.daemon = True self.daemon = True
self.msg = 'Keeping websocket alive with sequence {0[d]}' self.msg = 'Keeping websocket alive with sequence {0[d]}'
self._stop = threading.Event() self._stop_ev = threading.Event()
def run(self): def run(self):
while not self._stop.wait(self.interval): while not self._stop_ev.wait(self.interval):
data = self.get_payload() data = self.get_payload()
log.debug(self.msg.format(data)) log.debug(self.msg.format(data))
coro = self.ws.send_as_json(data) coro = self.ws.send_as_json(data)
@ -80,7 +80,7 @@ class KeepAliveHandler(threading.Thread):
} }
def stop(self): def stop(self):
self._stop.set() self._stop_ev.set()
class VoiceKeepAliveHandler(KeepAliveHandler): class VoiceKeepAliveHandler(KeepAliveHandler):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):