summaryrefslogtreecommitdiffstats
path: root/Lib/asyncio/timeouts.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/asyncio/timeouts.py')
-rw-r--r--Lib/asyncio/timeouts.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/Lib/asyncio/timeouts.py b/Lib/asyncio/timeouts.py
index a892053..94d2553 100644
--- a/Lib/asyncio/timeouts.py
+++ b/Lib/asyncio/timeouts.py
@@ -52,10 +52,10 @@ class Timeout:
self._timeout_handler = None
else:
loop = events.get_running_loop()
- self._timeout_handler = loop.call_at(
- when,
- self._on_timeout,
- )
+ if when <= loop.time():
+ self._timeout_handler = loop.call_soon(self._on_timeout)
+ else:
+ self._timeout_handler = loop.call_at(when, self._on_timeout)
def expired(self) -> bool:
"""Is timeout expired during execution?"""