mirror of
https://github.com/python/cpython.git
synced 2025-07-24 03:35:53 +00:00
Issue #20505: BaseEventLoop uses again the resolution of the clock to decide if
scheduled tasks should be executed or not.
This commit is contained in:
parent
b825a3937c
commit
6cf5c96630
2 changed files with 9 additions and 8 deletions
|
@ -96,6 +96,7 @@ class BaseEventLoop(events.AbstractEventLoop):
|
|||
self._default_executor = None
|
||||
self._internal_fds = 0
|
||||
self._running = False
|
||||
self._clock_resolution = time.get_clock_info('monotonic').resolution
|
||||
|
||||
def _make_socket_transport(self, sock, protocol, waiter=None, *,
|
||||
extra=None, server=None):
|
||||
|
@ -643,10 +644,10 @@ class BaseEventLoop(events.AbstractEventLoop):
|
|||
self._process_events(event_list)
|
||||
|
||||
# Handle 'later' callbacks that are ready.
|
||||
now = self.time()
|
||||
end_time = self.time() + self._clock_resolution
|
||||
while self._scheduled:
|
||||
handle = self._scheduled[0]
|
||||
if handle._when > now:
|
||||
if handle._when >= end_time:
|
||||
break
|
||||
handle = heapq.heappop(self._scheduled)
|
||||
self._ready.append(handle)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue