perf: increase selector timeout (#2)

This commit is contained in:
Ankush Menat 2025-01-13 19:00:53 +05:30 committed by GitHub
parent 0c9b266790
commit e5d5bc4e35
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -208,7 +208,10 @@ class ThreadWorker(base.Worker):
# can we accept more connections?
if self.nr_conns < self.worker_connections:
# wait for an event
events = self.poller.select(1.0)
select_timeout = self.timeout or 1.0
if self._keep:
select_timeout = min(select_timeout, self.cfg.keepalive)
events = self.poller.select(select_timeout)
for key, _ in events:
callback = key.data
callback(key.fileobj)