From 24194f3945634e10854b12cc5520cce79bd8473a Mon Sep 17 00:00:00 2001 From: Martin Wendt Date: Sun, 26 Jul 2020 15:16:43 +0200 Subject: [PATCH] Reduce `select` timeout from 0.1 to 0.01 Update #305 --- cheroot/connections.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cheroot/connections.py b/cheroot/connections.py index 57438386e9..89fd204e56 100644 --- a/cheroot/connections.py +++ b/cheroot/connections.py @@ -136,9 +136,12 @@ def get_conn(self, server_socket): try: for fno in socket_dict: self._selector.register(fno, selectors.EVENT_READ) + # The timeout value impacts performance and should be carefully + # chosen. Ref: + # github.com/cherrypy/cheroot/issues/305#issuecomment-663985165 rlist = [ key.fd for key, _event - in self._selector.select(timeout=0.1) + in self._selector.select(timeout=0.01) ] except OSError: # Mark any connection which no longer appears valid.