Don't keep doing keepalives if main loop dies

This commit is contained in:
Andrew Godwin 2015-11-06 13:34:50 +01:00
parent b9f07475b7
commit c937c4da6d

View File

@ -66,4 +66,5 @@ class WebsocketAsyncioInterface(object):
for protocol in self.factory.protocols.values():
if time.time() - protocol.last_keepalive > expiry_window:
protocol.sendKeepalive()
self.loop.call_later(1, self.keepalive_sender)
if self.loop.is_running():
self.loop.call_later(1, self.keepalive_sender)