From 27232951015c68e04b47560afe9abf0242912963 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A0=B4=E5=A8=83=E9=85=B1?= Date: Mon, 13 Feb 2017 01:38:48 +0800 Subject: [PATCH] fix CPU usage --- shadowsocks/eventloop.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/shadowsocks/eventloop.py b/shadowsocks/eventloop.py index a9560fa..5707154 100644 --- a/shadowsocks/eventloop.py +++ b/shadowsocks/eventloop.py @@ -222,8 +222,8 @@ class EventLoop(object): for callback in self._periodic_callbacks: callback() self._last_time = now - if events and (handle is False): - time.sleep(0.01) + if events and not handle: + time.sleep(0.02) def __del__(self): self._impl.close()