[3.6] bpo-34263 Cap timeout submitted to epoll/select etc. to one day. (GH-8532) (GH-8587)
This commit is contained in:
parent
ada5d99306
commit
6f16ffc187
|
@ -56,6 +56,9 @@ _FATAL_ERROR_IGNORE = (BrokenPipeError,
|
||||||
|
|
||||||
_HAS_IPv6 = hasattr(socket, 'AF_INET6')
|
_HAS_IPv6 = hasattr(socket, 'AF_INET6')
|
||||||
|
|
||||||
|
# Maximum timeout passed to select to avoid OS limitations
|
||||||
|
MAXIMUM_SELECT_TIMEOUT = 24 * 3600
|
||||||
|
|
||||||
|
|
||||||
def _format_handle(handle):
|
def _format_handle(handle):
|
||||||
cb = handle._callback
|
cb = handle._callback
|
||||||
|
@ -1378,7 +1381,7 @@ class BaseEventLoop(events.AbstractEventLoop):
|
||||||
elif self._scheduled:
|
elif self._scheduled:
|
||||||
# Compute the desired timeout.
|
# Compute the desired timeout.
|
||||||
when = self._scheduled[0]._when
|
when = self._scheduled[0]._when
|
||||||
timeout = max(0, when - self.time())
|
timeout = min(max(0, when - self.time()), MAXIMUM_SELECT_TIMEOUT)
|
||||||
|
|
||||||
if self._debug and timeout != 0:
|
if self._debug and timeout != 0:
|
||||||
t0 = self.time()
|
t0 = self.time()
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
asyncio's event loop will not pass timeouts longer than one day to
|
||||||
|
epoll/select etc.
|
Loading…
Reference in New Issue