summaryrefslogtreecommitdiff
path: root/game/python-extra
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2020-12-17 14:43:47 -0300
committerJesusaves <cpntb1@ymail.com>2020-12-17 14:43:47 -0300
commit7fcbe894d220e4e02ded4f7d8706cae6798211cc (patch)
tree3b9cc9ffd44cc36a1116cfe4fb4f6ebf86780db8 /game/python-extra
parent7c1dba1ebed9825e8ef0e1bb1fbd7dbb125397e0 (diff)
downloadclient-7fcbe894d220e4e02ded4f7d8706cae6798211cc.tar.gz
client-7fcbe894d220e4e02ded4f7d8706cae6798211cc.tar.bz2
client-7fcbe894d220e4e02ded4f7d8706cae6798211cc.tar.xz
client-7fcbe894d220e4e02ded4f7d8706cae6798211cc.zip
It is not being terribly "data-hungry", but well, there is CPU to consider as well.
Add extra delays to how often it heartbeats (2s -> 5s) and an extra delay between interactions (Now 50ms).
Diffstat (limited to 'game/python-extra')
-rw-r--r--game/python-extra/ws4py/websocket.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/game/python-extra/ws4py/websocket.py b/game/python-extra/ws4py/websocket.py
index f7e9e3a..9bca3a0 100644
--- a/game/python-extra/ws4py/websocket.py
+++ b/game/python-extra/ws4py/websocket.py
@@ -27,7 +27,7 @@ logger = logging.getLogger('ws4py')
__all__ = ['WebSocket', 'EchoWebSocket', 'Heartbeat']
class Heartbeat(threading.Thread):
- def __init__(self, websocket, frequency=2.0):
+ def __init__(self, websocket, frequency=5.0):
"""
Runs at a periodic interval specified by
`frequency` by sending an unsolicitated pong
@@ -603,6 +603,7 @@ class WebSocket(object):
while not self.terminated:
if not self.once():
break
+ time.sleep(0.05)
finally:
self.terminate()