mirror of
https://github.com/python/cpython.git
synced 2025-10-09 16:34:44 +00:00
gh-110733: Micro-optimization in BaseEventLoop._run_once (#110735)
This commit is contained in:
parent
41d8ec5a1b
commit
3ac8e6955f
2 changed files with 6 additions and 2 deletions
|
@ -1907,8 +1907,11 @@ class BaseEventLoop(events.AbstractEventLoop):
|
|||
timeout = 0
|
||||
elif self._scheduled:
|
||||
# Compute the desired timeout.
|
||||
when = self._scheduled[0]._when
|
||||
timeout = min(max(0, when - self.time()), MAXIMUM_SELECT_TIMEOUT)
|
||||
timeout = self._scheduled[0]._when - self.time()
|
||||
if timeout > MAXIMUM_SELECT_TIMEOUT:
|
||||
timeout = MAXIMUM_SELECT_TIMEOUT
|
||||
elif timeout < 0:
|
||||
timeout = 0
|
||||
|
||||
event_list = self._selector.select(timeout)
|
||||
self._process_events(event_list)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue