MCPcopy Create free account
hub / github.com/python-websockets/websockets / update

Method update

src/websockets/asyncio/async_timeout.py:219–238  ·  view source on GitHub ↗

Set deadline to absolute value. deadline argument points on the time in the same clock system as loop.time(). If new deadline is in the past the timeout is raised immediately. Please note: it is not POSIX time but a time with undefined starting base, e.g. t

(self, deadline: float)

Source from the content-addressed store, hash-verified

217 self.update(deadline + delay)
218
219 def update(self, deadline: float) -> None:
220 """Set deadline to absolute value.
221
222 deadline argument points on the time in the same clock system
223 as loop.time().
224
225 If new deadline is in the past the timeout is raised immediately.
226
227 Please note: it is not POSIX time but a time with
228 undefined starting base, e.g. the time of the system power on.
229 """
230 if self._state == _State.EXIT:
231 raise RuntimeError("cannot reschedule after exit from context manager")
232 if self._state == _State.TIMEOUT:
233 raise RuntimeError("cannot reschedule expired timeout")
234 if self._timeout_handler is not None:
235 self._timeout_handler.cancel()
236 self._deadline = deadline
237 if self._state != _State.INIT:
238 self._reschedule()
239
240 def _reschedule(self) -> None:
241 assert self._state == _State.ENTER

Callers 4

__init__Method · 0.95
shiftMethod · 0.95
handshakeMethod · 0.45
handshakeMethod · 0.45

Calls 1

_rescheduleMethod · 0.95

Tested by

no test coverage detected